Hello,
On my PC with ArcGIS Pro 3.4 and VS 2022 I made an CoreHost C# x64 application. The assemblies ArcGIS.Core and .CoreHost are Copy Local = Yes and Specific Version = No.
My colleague runs ArcGIS Pro 3.1.3 and the app - after installing .Net 8 - can't open a file geodatabase (but I can!). Instead he gets this errormessage:
System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
at ArcGIS.Core.Internal.Interop.GetInterface(Guid& id, Object& obj)
at ArcGIS.Core.Internal.Interop.get_Geodatabase()
at ArcGIS.Core.Data.GeodatabaseUtil.OpenDatastore(String path)
at ArcGIS.Core.Data.Geodatabase.Open(Uri uri)
at ArcGIS.Core.Data.Geodatabase..ctor(FileGeodatabaseConnectionPath connectionPath)
at (my code)
Uri uri = new(fgdbPath);
Geodatabase geodatabase = null;
if (fgdbPath.EndsWith(".gdb"))
{
FileGeodatabaseConnectionPath connPath = new(uri);
geodatabase = new(connPath); // --- here the code breaks ---
}
else if (fgdbPath.EndsWith(".geodatabase"))
{
MobileGeodatabaseConnectionPath connPath = new(uri);
geodatabase = new(connPath); // here the code breaks I suppose (but not tried)
}
My question:
- does it have anything to do with the older ArcGIS Pro version? If so, what should I do, unless upgrading all ArcGIS Pro installations?
Many thanks,
Pieter
Solved! Go to Solution.
3.1.3 was .NET 6. he will need to recompile against the .3.1 assemblies.
3.1.3 was .NET 6. he will need to recompile against the .3.1 assemblies.
Thanks for your answer. After a few days off the office, I've found a workaround: running the program on a virtual server with 3.4 which my colleague can access. I do not have administrative rights so for me this is the only way.
Charles got it, but as a general rule. If you want maximum support compile against the oldest API version that you want to support. While building against 3.2 "may" work with a 3.1 install, it may not. If built against 3.1, it will work with 3.1 and 3.2. .NET8 is supposed to be able to run .NET6 apps, so it should also run against 3.3+. To be sure though I always compile once against 3.1 for 3.1 and 3.2 installs and once against 3.3 for 3.3 -3.6. It is easy to tell what the user has installed at runtime and point them to use the proper executable.