Hello there, this is driving me crazy.
Since our update to ST9, an in-house app we have been using for 3 years is crashing when trying to get access to assemblies occurrences properties trough the ThisAsOccurrence property (in suboccurrences). It doesn't happen in all components, and it's a quite rare issue. Once it happens in one, it seems that all start to fail after it, when analyzing the whole assembly!
... Dim objThisAsOccurrence As SolidEdgeAssembly.Occurrence = objSubOccurrence.ThisAsOccurrence If Not objThisAsOccurrence.DisplayInSubAssembly Then 'This throws an exception Return False End If If Not objThisAsOccurrence.IncludeInBom Then 'This also throwns an exception Return False End If ...
Sometimes, when debugging and exposing that property in the Watch panel (Visual Studio) before reading the data, the problem doesn't appear, but this is not a valid workaround. Maybe the API can't keep track of the ThisAsOccurrence member content or something weird.
I have tried in different assemblies and the same pattern is always shown. Basically, we can't use our app with this (bug?), which is nearly a nightmare.
Any ideas? I have tried different ways of accessing that data (InvokeMember and so) with no success.
Thanks for any info
Edit: we have make further analysis and, as expected, reverting to ST8 makes the problem disappear. This problem has been detected on 3 different machines with ST9 and also ST9+MP3, both tested on each computer, over different assemblies (old, new, etc, etc) As said, what fails is accessing the occurrence properties (IncludeInBom and DisplayInSubAssembly, at least) below level 0, when SubOccurrences.ThisAsOccurrence member is called.
Too simple to fail and not a single problem shown on ST8, so this seems an internal bug, of catastrophic consequences, from our point of view. Again, some Watch while debugging exposing the info seems to jump the problem, maybe there can be some workaround to mimic that behaviour in a final release.
I tried to do the same in my visual studio 2013. But I have no problems.
We you sure that you use the right interop DLL?
On the other hand you could use the corresponding properties of the SubOccurrence object.
Thanks for your answer.
I'm using VS Community 2015.
Not sure wht do you mean about correct Interop, I removed and updated all references of SolidEdge inside the VS after installing ST9 (not sure if this is the way to go), but the problem persists, and as soon as I try to reach ThisAsOccurrence.IncludeInBom or ThisAsOccurrence.DisplayInSubAssembly, an exception is launched.
As you said, I have managed to solve this using the equivalent properties on the SubOccurrence object. In fact, I didn't know of their existence, although they are the negated equivalent:
SubOccurrence.ExcludeFromReports = Not Occurrence.IncludeInBom
SubOccurrence.HideInSubAssembly= Not Occurrence.DisplayInSubAssembly
With this, my particular problem is solved, but the whole thing intrigues me, mostly when I can reach other properties of ThisAsOccurrence with no issues (such as Quantity) and solidedgespy manages the whole stuff without any problems.
Much thanks for your answer, you can't imagine how helpful it has been.
There are several ways to get the interop libraries.
1) use the automatic from VS by selecting the COM lib.
2) use the Community Interops (useing NuGet)
3) generate the Interops with a script (see SDK folder in the installation medium)
I prefer the third method, because I have full control of the version and I also have the possibility to change the namespace. This avoids conflicts in an AddIn with other interops already loaded by the Solid Edge process.
Can you TypeCast the same object to "dynamic" and try to work with the properties .
I also faced exception issues when moved to VS2015 (Using C# .Net).
Let me know if this helps.