Select to view content in your preferred language

Unit Testing in Stand Alone CoreHost Pro Application

504
0
07-25-2023 05:46 PM
StephenDavis1
Emerging Contributor

Hi,

We recently upgraded our stand alone app, built on the Pro SDK/API, from 2.9 to 3.1. In the past we were able to unit test our code that uses the Pro API by simply calling Host.Initialize() on AssemblyInitialize in a test class. That no longer works with the move to 3.1. We have unit testing working correctly in our add-ins, because we followed your instructions here:

ProGuide Regression Testing · Esri/arcgis-pro-sdk Wiki · GitHub

However, that seems to actually start up Pro in a background thread, which is NOT what we want to do with a stand alone application, which shouldn't need a ProApp reference and a UI thread, unless I am misunderstanding. So, how can we get unit testing running again in a 3.1 stand alone Pro app? Currently, when we call Host.Initialize() is waits for a few seconds and acts like it is doing something. It lets us start a QueuedWorker or a QueuedTask, but when we actually try to do something with the API, like get a table definition or something, we get the following error:

System.InvalidOperationException: 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.

Are there any examples of the unit testing being successfully done in a corehost/stand alone app?

Just trying to think of what other information might be important...we are not using nuget for the Pro libraries, we are using direct assembly references from Program Files.

Any ideas? Thanks!

 

0 Kudos
0 Replies