Hi,In my application am having two threads.First thraed will be running in a
loop.In this first thread, i am trying to create an instance of
ManagementObjectSercher, to calculate the Physical memory size of a remote
system.

And in the second thread am trying to read an Excel file.

I am trying to run the threads simultaneously.The Second thread is running
smoothly.Its in the first thread am facing the error:

"System.Runtime.InteropServices.InvalidComObjectException: Com object that
has been seperated from its underlying RCW cannot be used.
at System.Management.IWmiSec.
BlessIEnumWbemClassObject(IEnumWbemClassObjectpIRnumWbemClassObject, String
user, String password, String authority, Int32 impersonationLevel, Int32
authenticationLevel)
at System.Management.ManagementScope.Secure(IEnumWbemClassObject wbemEnum)
at System.Management.SecurityHandler.Secure(IEnumWbemClassObject enumWbem)
at System.Management.ManagementObjectSearcher.Get()
--End of Inner exception stack trace --
at System.Management.ManagementException.ThrowWithExtendedInfo (Exception e)

at System.Mangement.MangementObjectSearcher.Get()
at XlsMgmtThreads_7988.Class1.Mgmt() "


First thread is running fine , upto 3 iteration of the for loop.But once the
Second thread is done, am getting this error in the first thread.
Can anyone,pls tell me why this is happening???What could be the problem??

Re: System.Runtime.InteropServices.InvalidComObjectException: Com object that has been seperated from its underlying RCW cannot be used. by Vadym

Vadym
Thu Oct 20 10:51:17 CDT 2005

Are COM objects created in the separate threads?

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com


"LeelaRamaDevi.Tangella" <tl_ramadevi@rediffmail.com> wrote in message
news:11b13dff7c3f42c8b9446cb59422948f@ureader.com...
> Hi,In my application am having two threads.First thraed will be running in
a
> loop.In this first thread, i am trying to create an instance of
> ManagementObjectSercher, to calculate the Physical memory size of a remote
> system.
>
> And in the second thread am trying to read an Excel file.
>
> I am trying to run the threads simultaneously.The Second thread is running
> smoothly.Its in the first thread am facing the error:
>
> "System.Runtime.InteropServices.InvalidComObjectException: Com object that
> has been seperated from its underlying RCW cannot be used.
> at System.Management.IWmiSec.
> BlessIEnumWbemClassObject(IEnumWbemClassObjectpIRnumWbemClassObject,
String
> user, String password, String authority, Int32 impersonationLevel, Int32
> authenticationLevel)
> at System.Management.ManagementScope.Secure(IEnumWbemClassObject wbemEnum)
> at System.Management.SecurityHandler.Secure(IEnumWbemClassObject enumWbem)
> at System.Management.ManagementObjectSearcher.Get()
> --End of Inner exception stack trace --
> at System.Management.ManagementException.ThrowWithExtendedInfo (Exception
e)
>
> at System.Mangement.MangementObjectSearcher.Get()
> at XlsMgmtThreads_7988.Class1.Mgmt() "
>
>
> First thread is running fine , upto 3 iteration of the for loop.But once
the
> Second thread is done, am getting this error in the first thread.
> Can anyone,pls tell me why this is happening???What could be the problem??