473,698 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 15 '05 #1
1 9034
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******** ******@tk2msftn gp13.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:

_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

Nov 15 '05 #2

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

Similar topics

3
1723
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(), the latter method stumbles upon an IO error and raises an exception. The calling method detects the exception, but needs to get input from the user before deciding whether A.CalledMethod() should continue being executed or permantently...
2
352
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 exception mechanism away from the c# end, all functions in the dll are embedded in catch-all blocks that return ‘false’ if anything throws an exception. Using a c++ program as the caller, the dll can be shown to work and return false on an...
5
3424
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 5), but fails on IIS 6 running on a Win2003 server. The web uses Pages derived from a custom class I wrote (which itself derives from Page) to provide some common functionality. The Page_Load handler the failing webpage starts out like this: ...
3
2734
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 logic layer) that inserts a user into a database, and returns the newly created UserID: public function CreateUser(userName as string, userEmail as string) dim userID as integer
5
24755
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 on a receive. We are using .NET v1.1.
9
2180
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! http://www.geocities.com/jeff_louie/oop30.htm Regards, Jeff *** Sent via Developersdex http://www.developersdex.com ***
2
1504
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 so appalling in my code that it gives experienced developers a touch of the vapours, I hope you'll be indulgent!) I've written my own code to handle unexpected exceptions and I've added this as the handler to Application.ThreadException. It all...
3
4069
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 from a .NET Web Application hosted on IIS. In our setup the web request form a client can be running for long duration (may be more than 4 hours). We are getting exceptions during the HTTP send/receive inside the web service method. The exception...
2
4366
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 code in VS2005 (to the same site with the same data) causes an exception 'The underlying connection was closed: An unexpected error occurred on a send.' Any ideas as to why and what I can do to get around this?
0
8673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7716
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4365
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2327
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.