protected override bool Initialize(Assembly assembly) { Type type = assembly.GetType("System.Net.Logging"); if (type == null) { string failure = "type 'System.Net.Logging' not found in assembly '" + assembly.FullName + "'"; SystemNetLogging.ReportFailure(1, failure); SystemNetLogging.ReportFailure(0, failure); return(false); } this.fieldEnabled = type.GetTypeInfo().GetDeclaredField("s_LoggingEnabled"); if (this.fieldEnabled == null || this.fieldEnabled.IsPublic || !this.fieldEnabled.IsStatic) { string failure2 = "static field 's_LoggingEnabled' not found in type 'System.Net.Logging'"; SystemNetLogging.ReportFailure(1, failure2); SystemNetLogging.ReportFailure(0, failure2); return(false); } SystemTrace.SetFieldValue(this.fieldEnabled, false); PropertyInfo declaredProperty = type.GetTypeInfo().GetDeclaredProperty("On"); if (declaredProperty == null) { string failure3 = "static property 'On' not found in 'System.Net.Logging' type"; SystemNetLogging.ReportFailure(1, failure3); SystemNetLogging.ReportFailure(0, failure3); return(false); } declaredProperty.GetValue(null, null); this.socketsSource = SystemNetLogging.GetTraceSource(1, "s_SocketsTraceSource", type); this.webSource = SystemNetLogging.GetTraceSource(0, "s_WebTraceSource", type); this.httpListenerSource = SystemNetLogging.GetTraceSource(2, "s_HttpListenerTraceSource", type); return(this.webSource != null || this.socketsSource != null || this.httpListenerSource != null); }