472,805 Members | 823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 3109
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
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.