Select to view content in your preferred language

Regression Test does not shutdown application properly

311
0
07-11-2023 08:10 AM
ole1986
New Contributor III

I have migrated the regression test example from our previous Arcgis Pro 2.9 to 3.1

After testing I noticed that the whole Test procedure keeps running (even all tests are already completed).

Reason for this is line 6 of the below snipped in `TestEnvironment.cs` and causes our DevOps operations to become freezed

public static void StopApplication()
        {
            try
            {
                if (Application != null)
                    Application.Shutdown();

            }
            catch (Exception e)
            {
                //do not re-throw the exception here.
                Debug.Print("Application.Shutdown threw an exception that was ignored. message: {0}", e.Message);
            }
        }

I workaround this by gracefully kill the testhost.exe process as following

public static void StopApplication()
        {
            try
            {
                if (Application != null)
                {
                    var proc = Process.GetCurrentProcess();
                    proc.CloseMainWindow();
                    // below might hang after all tests succeeded
                    //Application.Shutdown();
                }

            }
            catch (Exception e)
            {
                //do not re-throw the exception here.
                Debug.Print("Application.Shutdown threw an exception that was ignored. message: {0}", e.Message);
            }
        }

Luckily the results are not affected after killing the process that way.

Also, there are no project edits or pending save operations.

Regards

0 Kudos
0 Replies