Hi all,
I'm hoping someone can help me with this bizarre problem. If I create a
new PerformanceCoun ter object in a ComVisible class and invoke it from
wscript, it never seems to terminate. When debugging, Visual Studio
never leaves the (running) state when the Go function exits (even
clicking the 'Stop Debugging' button fails). When not debugging, the
cscript / wscript.exe process never leaves memory.
I've tried this same code in a console app and a simple form based app
and they both terminate correctly. I've tried manually calling
counter.Close() but that didn't help either. Does anyone know what
causes this behaviour?
The only similar issue I was able to find can be found here:
http://www.dotnet247.com/247referenc...24/121316.aspx
I have all the latest framework service packs however so this doesn't
appear to be relevant.
using System.Diagnost ics;
using System.Runtime. InteropServices ;
namespace CounterTest
{
[ClassInterface( ClassInterfaceT ype.AutoDispatc h)]
[GuidAttribute(" 652B14C2-0221-4bff-A4AB-98DF2DB312E6")]
[ProgId("Counter Test.ThisWillHa ng")]
[ComVisible(true )]
public class ThisWillHang
{
public void Go()
{
PerformanceCoun ter counter = new
PerformanceCoun ter("Processor" , "% Processor Time", "_Total");
}
}
}