-
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dl
All,
I'm trying to validate the code below for the case where the
ManagementObjectSearcher can not connect
to the specified server and get the exception
"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: The RPC server is unavailable. "
When press continue my exception code executes.
My expectation is that my exception code should execute without the
additional message above?
Any idea why this is happening.
Thanks
Mike Willis
for( int i=0; i<m_lb.Items .Count; i++ )
{
//set sServer
try
{
String scope="\\\\"+ sServer +"\\root\\cimv2";
ManagementObjectSearcher searcher = new
ManagementObjectSearcher(scope,select,eOpts);
foreach (ManagementObject d in searcher.Get())
{
//do some stuff
}
}
catch ( System.Runtime.InteropServices.COMException e )
{
/ /report exception
}
//other exceptions
}//for
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|