Uwe Keim Uwe Keim - 1 year ago 146
C# Question

Closing IActiveScript engine throws E_UNEXPECTED exception

Working with C# in .NET, I am trying to call

on my instance of the Windows Scripting host.

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

Unfortunately, when calling the
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


How can I gracefully call
without getting an exception thrown?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download