Thanks Rich.
We have encountered another issue with RasterDatasetDefinition, and I'm not sure if it will turn out to be related to the above issue or not.
We had some code that opened a RasterDataset to fetch its RasterDatasetDefinition, as a sort of workaround for the above. It appeared to work correctly, and we got valid Definitions from it. However, some calls later, we would get a crash in code that previously worked fine in smaller tests. There was a _purecall() error occurring during calls to OpenDataset<RasterDataset>(), CreateFullRaster() and some others. Most of the cases also had ArcGIS.Core.Internal.Interop.SweepReleaseList() in the stack.
We spent quite some time making sure we are handling object lifetimes and Dispose() correctly, but in the end what worked is to never use RasterDatasetDefinition, at all. I guess something about it corrupts the data that SweepReleaseList() uses, hence causing the _purecall() crashes.
Example call stack:
ucrtbase.dll!abort‑() Unknown
vcruntime140.dll!_purecall() Line 29 C++
RasterCoreLib.dll!00007ffb45fb244e() Unknown
RasterCoreLib.dll!00007ffb45fb1bec() Unknown
FgdbRasterDB.dll!00007ffb4a0c6df2() Unknown
FgdbRasterDB.dll!00007ffb4a0c6b44() Unknown
FgdbRasterDB.dll!00007ffb4a0e4188() Unknown
CoreInterop.dll!00007ffb4a20f05a() Unknown
[Managed to Native Transition]
ArcGIS.Core.dll!ArcGIS.Core.Internal.Interop.SweepReleaseList() Unknown
ArcGIS.Core.dll!ArcGIS.Core.CoreObjectsBase.Attach(System.IntPtr handle) Unknown
ArcGIS.Core.dll!ArcGIS.Core.Data.Dataset.Dataset(System.IntPtr datasetHandle, ArcGIS.Core.Data.Datastore datastore) Unknown
ArcGIS.Core.dll!ArcGIS.Core.Data.GeodatabaseCore.OpenDatasetCore<ArcGIS.Core.Data.Raster.RasterDataset>(string name) Unknown