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
Maybe it takes a while to initialize Contact
object (ie download data from internet). If it is done asynchronous then when you set a breakpoint you give program a time to do it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.