Unexpected Exception calling a WMI Method

  • Thread starter Thread starter Christoph Schittko [MVP]
  • Start date Start date
C

Christoph Schittko [MVP]

I wrote a custom WMI method provider in unmanaged C++.

When I access the method from C# I get an SystemException with this
information:

_COMPlusExceptionCode 0xe0434f4d int
_HResult 0x80131501 int
Message "Unexpected error " string

but I know the method executed successful and ExecMethodAsync in the
provider returned S_OK, so the exception is happening somewhere in the
plumbing after the provider call completed. The provider, btw is running as
a Windows Service ...

The C# code to call the method is rather trivial as well:

ManagementObject obj = new ManagementObject( "MyService=@" );
obj.InvokeMethod( "Restart", new object[0] );

I also tried:

ManagementObject obj = new ManagementObject( "MyService=@" );
obj.InvokeMethod( "Restart", null );

but got the same result.

Am I missing something?
 
I DID return S_OK, but I DIDN'T call SetStatus on the ResponseHandler ... ts
ts ts
Thanks,
 
Back
Top