Catching DCOM exception in Windows event log viewer

Viewed 13

I have a problem with annoying event in Windows Event Viewer, everytime I get a System.Runtime.InteropServices.COMException in my C# code. Is there a way to prevent logging this error?

try
{
   ManagementScope scope = new($"\\\\192.168.173.30\\ROOT\\cimv2",connectionOptions);
   scope.Connect();
}
catch (System.Runtime.InteropServices.COMException comException)
{
   //do some stuff
}
catch (Exception ex)
{
   //do some stuff
}

enter image description here

0 Answers
Related