Converting ArcGIS Pro NUnit Test from ArcGIS Pro 2.5 to ArcGIS Pro 3.0.
Every time an ArcGIS.Core classes is used I get the following error message:
Dependency resolution failed for component C:\Program Files\ArcGIS\Pro\bin\CoreInterop.dll with error code -2147450750. Detailed error: Hostpolicy must be initialized and corehost_main must have been called before calling corehost_resolve_component_dependencies.
Tests not using CoreHost run.
Test are using nunit
Using Visual Studio 2022 Version 17.3.0
Using Microsoft.NET.Test.Sdk (17.3.2) package
Using NUnit (3.13.3) package
Tests call Host.Initialize() without getting exceptions
Tests calling ArcGIS.Core classes are generally async since we are testing actual code that is used in addins.
These tests worked previously in ArcGIS Pro 2.5.
Has anyone else had a similar problem?
Any help would be greatly appreciated.
Hi Steven,
When I upgraded to 3.0 I also had some issues with unit tests. Have you checked https://github.com/EsriJapan/arcgis-pro-sdk/wiki/ProGuide-Regression-Testing? This helped me figuring out how to get my NUnit tests up and running. Key seems to be the helper classes (ArcGISTestClassAttribute, TestResolver, TestEnvironment). ProApp.TestModeInitializeAsync() seems to be required for certain operations, e.g. QueuedTask.Run(). See the attached solution for an example.