Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Closing IActiveScript engine throws E_UNEXPECTED exception

Tags:

c#

scripting

Working with C# in .NET, I am trying to call IActiveScript.Close on my instance of the Windows Scripting host.

Since I am currently hunting memory leaks, I discovered that I did not call this Close method and tried to add the missing code. So I added a call to the Closemethod.

Unfortunately, when calling the Close method, a COM exception is thrown with E_UNEXPECTED as the error code.

Querying the script state of the engine before closing it, it returns SCRIPTSTATE_CONNECTED.

Question:

How can I gracefully call IActiveScript.Close without getting an exception thrown?

like image 886
Uwe Keim Avatar asked Jan 28 '26 20:01

Uwe Keim


1 Answers

To (partially) answer my own question:

I finally managed to build a stand-alone test application where I successfully can call the IActiveScript.Close method and also have no memory leaks.

like image 90
Uwe Keim Avatar answered Jan 30 '26 09:01

Uwe Keim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!