Debug ArcObjects on .NET 4.x

579
3
Jump to solution
10-01-2018 06:19 AM
CarstenSchumann
Occasional Contributor

We recently migrated our code for ArcObjects from ArcGIS 10.2.2 and .NET 3.5 to ArcGIS 10.6.1 and .NET 4.5.1. 

To debug our program we heavily use the debugging-fgeatures from Visual Studio. E.g. we have code like this:

IGeometry geometry = // get a geometry
// do something with the geometry‍‍‍‍‍‍‍‍‍‍‍‍

With .NET 3.5. it was possible to examine this object, see here

However since .NET 4 this is not anymore possible, see thie following image:

I also posted this question on StackOverflow and gis.stackexchange to no avail. All I got to know is that is has to do with the way .NET wraps the unmanaged COM-objects. All my references to ESRI-assemblies have the "Embed Interop Types"-property set to false, as suggested in the answer on StackOverflow.

So why is this and how can we see the COM-objects properties on .NET 4.x?

1 Solution

Accepted Solutions
CarstenSchumann
Occasional Contributor

We finally solved that problem by enabling an option in Visual Studio:

Tools-->Options-->Debuuging--> enable "Use Managed Compatibility Mode"

View solution in original post

3 Replies
CarstenSchumann
Occasional Contributor

We finally solved that problem by enabling an option in Visual Studio:

Tools-->Options-->Debuuging--> enable "Use Managed Compatibility Mode"

View solution in original post

DuncanHornby
MVP Frequent Contributor

If we ever cross paths I owe you a beer (or two)! Just been banging my head against a wall with exactly the same issue. I too had just made the jump from 10.2 to 10.6 and upgraded to VS 2017 community and could not debug correctly. How on Earth did you work out it was this setting?

0 Kudos
CarstenSchumann
Occasional Contributor

I will remember . Greatly appreciate your feedback. I searched a lot for this and it took me a week or so.

0 Kudos