Ask a Question

Issues when closing my application using test script

Frequent Contributor

Issues when closing my application using test script

I am trying to close my application at the end of the test and running into some issues:




This is not closing my application. It seems to not do anything.


Issue#2 (Sys.WaitProcess("MyApplication").Exists seems to not give expected results)

Because of issue#1, I changed that line. Using object spy, I got the alias name of the main application window and I applied to it the close method. This is closing the application as expected. After closing the application, I want to confirm that the application is closed, so I use sys.waitprocess("myapplication").exists but this is where the issue is. It closes the application, then at the step p.Exists, it returns True but I am expecting a False since the application is closed. I ran the script and noted that the application closes, but for some reason sys.waitprocess still thinks that the application exists. I even checked my task manager and confirmed that the application was not present there.

var p = Sys.WaitProcess("MyApplication");
Log.Message("My application did not close. Trying to close the application using taskkill command.")
Log.Message("Success: My application is now closed.")



While investigating the above issue, I checked my Event Viewer and I see an error which is pointing to "C:\WINDOWS\System32\ucrtbase.dll" which is the Universal C Runtime in Windows


Error log:

Faulting application name: MyApplication.exe, version:, time stamp: 0x00000000
Faulting module name: ucrtbase.dll, version: 10.0.17763.404, time stamp: 0x490b0aeb
Exception code: 0xc0000409
Fault offset: 0x000000000006e91e
Faulting process id: 0x4704
Faulting application start time: 0x01d52baa39f508c6
Faulting application path: C:\Program Files\........\MyApplication.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report Id: 24cd6551-a43e-4e97-8e18-758f7a52723c
Faulting package full name:
Faulting package-relative application ID:


I read online about this error and found some answer:


Maybe these issues are unrelated but I am not sure.


Thank you any suggestions!!

SmartBear Alumni (Retired)

Hi @sameerjade,


Thanks for posting your questions. I recommend that you create one topic per question in the future - you will get the answers much faster.


As for the issues,


Will Terminate work?



I recommend that you specify the timeout parameter in the WaitProcess method.

Sys.WaitProcess("MyApplication", 10000).Exists



Could you please clarify when exactly you get this exception?

Tanya Yatskovskaya
SmartBear Community and Education Manager

Thank you! Terminate worked for me.

Showing results for 
Search instead for 
Did you mean: