473,804 Members | 3,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ManagementClass .GetInstances() throws COM exception

Hi there,

We have created a custom adapter for Microsoft BizTalk using C#. We wish to
add the adapter to the BizTalk adapters list automatically upon install and
remove it on uninstall. We found this code, which seemed to do exactly what
we want:

geekswithblogs. net/cmcneill/ archive/2005/04/05/28336.aspx

However, when running the Uninstall method, an exception is thrown at the
line:

ManagementObjec tCollection adapterObjects = adapterClass.Ge tInstances();

The exception is: "System.Runtime .InteropService s.InvalidComObj ectException:
COM object
that has been separated from its underlying RCW can not be used"

Now, just for kicks I decided to install SP1 for .NET framework 1.1, and
voila, no exception. However, it seems a ridiculous requirement to have this
service pack installed just to run this one function that is only called
once on uninstall. Is there any other way to get around this problem (and
what is the problem anyways??) . Any insight on this is appreciated.

Jul 21 '05 #1
1 3187
Sorry, the link is

http://geekswithblogs.net/cmcneill/a.../05/28336.aspx

"Ryan Berry" wrote:
Hi there,

We have created a custom adapter for Microsoft BizTalk using C#. We wish to
add the adapter to the BizTalk adapters list automatically upon install and
remove it on uninstall. We found this code, which seemed to do exactly what
we want:

geekswithblogs. net/cmcneill/ archive/2005/04/05/28336.aspx

However, when running the Uninstall method, an exception is thrown at the
line:

ManagementObjec tCollection adapterObjects = adapterClass.Ge tInstances();

The exception is: "System.Runtime .InteropService s.InvalidComObj ectException:
COM object
that has been separated from its underlying RCW can not be used"

Now, just for kicks I decided to install SP1 for .NET framework 1.1, and
voila, no exception. However, it seems a ridiculous requirement to have this
service pack installed just to run this one function that is only called
once on uninstall. Is there any other way to get around this problem (and
what is the problem anyways??) . Any insight on this is appreciated.

Jul 21 '05 #2

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

Similar topics

2
14050
by: Paul Gronka | last post by:
I've got a VB.NET windows application (written in VS .NET 2003) that makes a call to WMI for retrieving the MAC Address from the client's PC. It works on 4 out of the 5 PC's tested so far. All the workstations are DELLs running XP SP1a with the 1.1 .NET Framework. The following line of code generates an exception on the one PC: Dim oMac As New System.Management.ManagementClass("Win32_NetworkAdapterConfiguration") The error it...
2
2952
by: Daniel | last post by:
if System.IO.StreamWriter write throws an exception, is there anyway to close the System.IO.StreamWriter object? it seems to stay open when this happens then future attempts to write to that same path fail because it says its in use by another process.
4
5910
by: Steve Teeples | last post by:
I am calling the method GetInstances() within the ManagementClass. I have 48 applications on my system. Mearly calling the routine takes 28 seconds for it to return. I don't understand why this method would take so long to execute. I've tried setting the EnumerationOptions.EnumerateDeep to false but it doesn't seem to have any impact on the time. Can someone tell me how to speed up the execution of this method? -- Steve
1
277
by: Ryan Berry | last post by:
Hi there, We have created a custom adapter for Microsoft BizTalk using C#. We wish to add the adapter to the BizTalk adapters list automatically upon install and remove it on uninstall. We found this code, which seemed to do exactly what we want: geekswithblogs.net/cmcneill/ archive/2005/04/05/28336.aspx However, when running the Uninstall method, an exception is thrown at the
3
23334
by: Anil Gupte | last post by:
I am getting this error: Type 'System.Management.ManagementClass' is not defined. The statement is: Dim diskClass As New System.Management.ManagementClass("Win32_LogicalDisk") According to the help file, this 'System.Management.ManagementClass' is under System.Object, so I put in the Imports System.Object in namespace, but that seems not to help.
0
2201
by: sachinrohamare | last post by:
I am getting following error while iterating through the ManagementObjectCollection: This error is coming only for the first time. From the 2nd run onwards the code is executed successfully. Surprisingly when I execute the code with the gap of 20-25 minutes the error is reproducible! Please provide the solution urgently. Thanks in Advance ! Please check the error details, sample C# code I am using. Regards,
2
4559
by: bevis | last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you can. I'm using Eclipse 3.2.2 and I have installed mysql-connector-java-5.0.6-bin.jar. I am trying to connect to SQL Enterprise Manager version 8.0 innstall on a Windows 2003 Server Enterprise Edition. I have been able to successfully test...
2
3309
by: =?Utf-8?B?Qy4gSHVnaGVz?= | last post by:
Hi, I can't figure it out. A piece of code to obtain the Processor ID which has always worked fine, suddenly throws an UnauthorizedAccessException. I have changed absolutely nothing to my code, and nothing to my system. The same code works fine on a different computer. The code in question: string cpuInfo = String.Empty; ManagementClass mc = new ManagementClass("Win32_Processor"); ManagementObjectCollection moc = mc.GetInstances();
4
3999
by: diyasher | last post by:
hello while running program that use system.management namespace and holds management event the exception throws "not found" and some time "not supported" unhandled management exception on management event start() method, i am using windows xp professional sp2, the sample code is class Program { public static void Main(string args) { ManagementScope scope = new...
0
9706
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
10571
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
10317
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
10075
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
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.