WCF Code Analysis - Object Instance not set to an instance of an object

Topics: Service Factory Modeling Edition Forum
Jul 24, 2008 at 3:23 PM
Hi,

I'm having problems with WCF Code Analysis for Service Factory : Modelling Edition (VS2005).

When I run the Code Analysis, I get a Object Instance not set to an instance of an object error.
Why this happen I cannot determine.

When running the code using my test shell (nUnit) everything is fine.
But when calling the WCF Webservice, I get the Object Instance not set to an instance of an object error.

I've traced it to an extend where the error occurs after my custom code is execute, thus I suspect that the exception occurs when it tries to serialize the return message.
I'm using the the notmal message, and not the XSD message, as well as Data Contract Message parts.

I'll be glad to provide the service and data contracts for anyone who can assist to let me know where I went wrong.

Thanx in advance.

Riaan
Developer
Jul 24, 2008 at 3:57 PM
It seems like some rule may be throwing that exception and when you tru to run your site this rule is set and therefore breaking the build. Try to uncheck WCF Code Analysis rules (or Code Analysis at all) and build.
On the other hand, the unit does not trigger CA so that's why you don't get the exception.
Regarding the error, is hard to know which rule may be throwing unless you go and check only one rule at a time on each project until you find the guilty :)