473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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:

_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?
--
HTH
Christoph Schittko [MVP, XmlInsider]
Software Architect, .NET Mentor
Nov 15 '05 #1
1 9006
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]" <ch********************@austin.rr.com> wrote in
message news:ut**************@tk2msftngp13.phx.gbl...
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?
--
HTH
Christoph Schittko [MVP, XmlInsider]
Software Architect, .NET Mentor

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MackS | last post by:
Hi I'm new to Python and would like to know if the following is possible. Say I have one lower-level object A and one user-interface object B. Suppose B.CallingMethod() calls A.CalledMethod(),...
2
by: Ascaron | last post by:
Hi there! I’m having a strange problem with a c++ dll that is called from a c# program. The dll wraps a large piece of c++ software that uses exceptions for its error-signalling. To keep the...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
3
by: Sean Tynan | last post by:
I want to find out the best way for a method to notify calling code of situations such as validation errors, etc. that may occur during method execution. e.g. say I have a method (business...
5
by: Vijayakrishna Pondala | last post by:
Hi, We are using the following error randomly, when accessing a webservice method/servlet hosted on JBoss application server: The underlying connection was closed: An unexpected error occurred...
9
by: Jeff Louie | last post by:
In C# (and C++/cli) the destructor will be called even if an exception is thrown in the constructor. IMHO, this is unexpected behavior that can lead to an invalid system state. So beware! ...
2
by: paul.mason | last post by:
I was wondering if anyone else had come across this "feature" of .NET and if they had any idea what might be causing it. I've been writing my first C# Windows application (so if there's anything...
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
2
by: Andrew Hunot | last post by:
I have VB code in VS2003 which creates a HttpWebRequest and performs a POST operation to a remote URL (an https site), which runs fine and receives a valid response. However exactly the same...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.