System.Runtime.InteropServices.InvalidComObjectException: Com object that has been seperated from it

  • Thread starter LeelaRamaDevi.Tangella
  • Start date
L

LeelaRamaDevi.Tangella

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??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top