protected override PSProperty DoGetProperty(ManagementBaseObject wmiObject, string propertyName) { PropertyData adapterData = null; // First check whether we have any Class properties by this name PSProperty returnValue = base.DoGetProperty(wmiObject, propertyName); if (returnValue != null) { return(returnValue); } try { adapterData = wmiObject.Properties[propertyName]; return(new PSProperty(adapterData.Name, this, wmiObject, adapterData)); } catch (ManagementException) { } catch (Exception e) { CommandProcessorBase.CheckForSevereException(e); // TODO: Bug 251457. This is a workaround to unblock partners and find out the root cause. Tracing.PSEtwLogProvider provider = new Tracing.PSEtwLogProvider(); provider.WriteEvent(PSEventId.Engine_Health, PSChannel.Analytic, PSOpcode.Exception, PSLevel.Informational, PSTask.None, PSKeyword.UseAlwaysOperational, string.Format(CultureInfo.InvariantCulture, "ManagementBaseObjectAdapter::DoGetProperty::PropertyName:{0}, Exception:{1}, StackTrace:{2}", propertyName, e.Message, e.StackTrace), string.Empty, string.Empty); // ignore the exception. } return(null); }
/// <summary> /// Logs information to the operational channel /// </summary> /// <param name="id"></param> /// <param name="opcode"></param> /// <param name="task"></param> /// <param name="keyword"></param> /// <param name="args"></param> internal static void LogOperationalInformation(PSEventId id, PSOpcode opcode, PSTask task, PSKeyword keyword, params object[] args) { provider.WriteEvent(id, PSChannel.Operational, opcode, PSLevel.Informational, task, keyword, args); }
internal static void LogAnalyticError(PSEventId id, PSOpcode opcode, PSTask task, PSKeyword keyword, params object[] args) { provider.WriteEvent(id, PSChannel.Analytic, opcode, PSLevel.Error, task, keyword, args); }