/// <summary/> /// <param name="baseEvent"/> /// <exclude/> /// <devdoc> /// The reason it wraps the BaseEvent.Fire method is to allow Wmi /// events to be turned on and off in the Instrumentation assembly. /// Otherwise, for all the frameworks, the compiler switch needs to /// be turned on/off for all the Instrumentation.xxx projects. /// </devdoc> public static void FireWmiEvent(BaseEvent baseEvent) { FireWmiEventCore(baseEvent); }
private static void FireWmiEventCore(BaseEvent baseEvent) { try { baseEvent.Fire(); } catch (Exception exp) { string msg = SR.WmiEventFailure(baseEvent.GetType().Name, GetErrorMessage(exp)); COMException comException = exp as COMException; if (null != comException) { if ((uint)comException.ErrorCode == WbemAccessDenied) { msg = string.Concat(SR.ExceptionAccessDeniedFailure, msg); } } ReportWmiFailure(msg); } }