Hello,
when I start to create/open a FileGeodatabase in c#, with the ArcGIS Pro SDK, e.g.
using (Geodatabase fileGeodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(gdbPath))))
{
// can open geodatabase
return true;
}
I get the following Exception:
'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'
Courious the Exception occurs only on some PC, often with ArcGIS 3.1
Any help is welcome
Marcus
What version was the fGDB created with? If it's a newer version, it may have some data types and functionality not available in 3.1.
Thanks for your reaction.
The fGDB was created with the same ArcGIS Pro Version, on the same machine, which is also used for the "new Geodatabase"-Function in c#. In the case it is ArcGIS Pro 3.1.41833
Hi,
Are you trying to open geodatabase from core host application? Same error is here.
Check project .NET version. For 3.1.x was .NET 6.
Thank you for your reply. This is the same thing I was thinking about. but I haven't been able to try it yet.
So I need to compile multiple core host applications, one for each ArcGIS Pro version?
It's not a good solution, but apparently necessary.
You need to compile core host application for each ArcGIS Pro SDK which use newest .NET version:
ArcGIS Pro SDK 2.9.x - .NET Framework 4.8
ArcGIS Pro SDK 3.0.x - ArcGIS Pro SDK 3.2.x - .NET 6.0
ArcGIS Pro SDK 3.3.x - ArcGIS Pro SDK 3.4.x - .NET 8.0
Hi @TOPOGRAPHICS ,
Ensure ArcGIS Pro and SDK Compatibility
Check File Geodatabase Version File Geodatabases have versions that define compatibility. For example:
Additionally, could you please check if you are using QueuedTask.Run before opening the geodatabase in your code, as shown below?
try
{
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
// Opens a file geodatabase. This will open the geodatabase if the folder exists and contains a valid geodatabase.
using (
Geodatabase geodatabase =
new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"\\path to gdb"))))
{
// Use the geodatabase.
}
});
}
catch (GeodatabaseNotFoundOrOpenedException exception)
{
// Handle Exception.
}