Showing results for 
Search instead for 
Did you mean: 

Property Access Exception vs. VisualStudio 'Dynamic View' debugging


This post is really linked with this, posted by myself last week but I think it's quite interesting, and in a general purpose manner:


In short, accessing some properties of the object returned by ThisAsOccurrence (IncludeInBOM and DisplayInSubAssembly, not sure if some more...) launches an exception. However, if we debug the application and expand the Dynamic view of that object before accesing any property, all works fine.


Not sure what does internally trigger Visual Studio when expanding a COM object in the debugging watch window, but it allows collecting the data with no unwanted exceptions. That same data is not reachable when the debugging watch is not there.


Also, SolidEdgeSpy can access those properties without issues, so maybe it's me who is not using the correct approach, but the fun fact is that I have no problem reading hundreds of other properties for different purposes. All this started to fail when updating to SP9, it has been working fine for ages until now.



Is this simply a particular bug or shall we widely expect this behaviour around the API? Is there a more solid way to access COM data? In any case, can we replicate with release-code what 'Expanding Dynamic View' does on VS debugging in order to patch this? I think these are interesting questions for everyone


Thanks for your interest, I hope this info can be useful for someone.