C# / Visual Studio - Object is null unless I have a Breakpoint

Posted by user576611 on Stack Overflow See other posts from Stack Overflow or by user576611
Published on 2011-01-15T09:44:42Z Indexed on 2011/01/15 9:54 UTC
Read the original article Hit count: 185

Hi Everyone,

I'm specifically using the Google Contacts API at the moment, but this could be true of other scinarios as well.

I have the following code:

Contact newContact = new Contact();

When I let the code run without any breakpoints, I get a NullReferenceException on all of the properties of this object. However, if I put a breakpoint just after this line, I can see all of the properties have been initialises and the rest of my code executes fine.

Any idea's would be greatly appreciated

© Stack Overflow or respective owner

Related posts about c#

Related posts about debugging