Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BUG:Scope.IsConnected does not work as described [RPC_E_DISCONNECTED]

112 views
Skip to first unread message

scamb

unread,
Dec 18, 2009, 5:27:34 AM12/18/09
to
Hello !

I am working on a management helper application, which deals with
long running connections and these breaks with the following error:

Unhandled Exception: System.Runtime.InteropServices.COMException
(0x80010108):
The object invoked has disconnected from its clients.
(Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)

There is not really any helpful information on this and how connections
work. As many times with WMI, I am dealing with a problem and the docs
drives me mad :-(

There is nearly only the following sentence in the docs, which describes
the connect/disconnect behavior [see:ManagementScope.IsConnected]:

"the scope is disconnected from the previous connection whenever the
identifying properties of the scope are changed"
...


My code is usually working as long as my wmi-requests are made
with short timeintervals. Imagine the folloing code [C#]:


ConnectionOptions co; //setting credentials and timeout
ManagementScope ms; //specifying remote machine
ManagementObjectCollection moc;

ms.Connect();

//moc = ...SelectQuery(ms, "select * from Win32_LogicalDisk"); //OK

while(true)
{
Thread.Sleep(3600); //Think app is doing other work.
if(!ms.IsConnected) //Never FALSE!!!
{
Console.WriteLine("Scope was NOT connected");
ms.Connect(); //Never called,
//but if done always, don't help!!
}
//[BOMB]Here is where the problem occurs:
moc = ...SelectQuery(ms, "select * from Win32_LogicalDisk");
}

Regard:There is no .Dispose() currently and so the objects should still
be alive and - regard the "docs", the "identifying properties of the
scope" were never changed!!!

Any help would be really great, I am currently really
out of hope now.

br--scamb

0 new messages