Unexpected Exception calling a WMI Method

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christoph Schittko [MVP]

    Unexpected Exception calling a WMI Method

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

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

    _COMPlusExcepti onCode 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:

    ManagementObjec t obj = new ManagementObjec t( "MyService= @" );
    obj.InvokeMetho d( "Restart", new object[0] );

    I also tried:

    ManagementObjec t obj = new ManagementObjec t( "MyService= @" );
    obj.InvokeMetho d( "Restart", null );

    but got the same result.

    Am I missing something?
    --
    HTH
    Christoph Schittko [MVP, XmlInsider]
    Software Architect, .NET Mentor


  • Christoph Schittko [MVP]

    #2
    Re: Unexpected Exception calling a WMI Method

    I DID return S_OK, but I DIDN'T call SetStatus on the ResponseHandler ... ts
    ts ts
    Thanks,
    --
    Christoph Schittko [MVP, XmlInsider]
    Software Architect, .NET Mentor

    "Christoph Schittko [MVP]" <christophdotne tINVALID@austin .rr.com> wrote in
    message news:utGbchKqDH A.2588@tk2msftn gp13.phx.gbl...[color=blue]
    > I wrote a custom WMI method provider in unmanaged C++.
    >
    > When I access the method from C# I get an SystemException with this
    > information:
    >
    > _COMPlusExcepti onCode 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[/color]
    as[color=blue]
    > a Windows Service ...
    >
    > The C# code to call the method is rather trivial as well:
    >
    > ManagementObjec t obj = new ManagementObjec t( "MyService= @" );
    > obj.InvokeMetho d( "Restart", new object[0] );
    >
    > I also tried:
    >
    > ManagementObjec t obj = new ManagementObjec t( "MyService= @" );
    > obj.InvokeMetho d( "Restart", null );
    >
    > but got the same result.
    >
    > Am I missing something?
    > --
    > HTH
    > Christoph Schittko [MVP, XmlInsider]
    > Software Architect, .NET Mentor
    >
    >[/color]


    Comment

    Working...