473,386 Members | 1,846 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,386 software developers and data experts.

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:

ManagementObjectCollection adapterObjects = adapterClass.GetInstances();

The exception is: "System.Runtime.InteropServices.InvalidComObjectEx ception:
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 3154
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:

ManagementObjectCollection adapterObjects = adapterClass.GetInstances();

The exception is: "System.Runtime.InteropServices.InvalidComObjectEx ception:
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
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...
2
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...
4
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...
1
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...
3
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...
0
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....
2
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...
2
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,...
4
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...

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.