public override bool Execute() { if (_bootstrapPath == null) { Log.LogError($"{nameof(ValidateBootstrap)} task must have a {nameof(BootstrapPath)} parameter."); return false; } var dependencies = new[] { typeof(ValidateBootstrap).GetTypeInfo().Assembly, typeof(CSharpCompilation).GetTypeInfo().Assembly, typeof(Compilation).GetTypeInfo().Assembly, }; var allGood = true; var comparer = StringComparer.OrdinalIgnoreCase; foreach (var dependency in dependencies) { var path = GetDirectory(dependency); path = NormalizePath(path); if (!comparer.Equals(path, _bootstrapPath)) { Log.LogError($"Bootstrap assembly {dependency.GetName().Name} incorrectly loaded from {path} instead of {_bootstrapPath}"); allGood = false; } } return allGood; }
public override bool Execute() { if (_bootstrapPath == null) { Log.LogError($"{nameof(ValidateBootstrap)} task must have a {nameof(BootstrapPath)} parameter."); return false; } var dependencies = new[] { typeof(ValidateBootstrap).GetTypeInfo().Assembly, }; var allGood = true; var comparer = StringComparer.OrdinalIgnoreCase; foreach (var dependency in dependencies) { var path = GetDirectory(dependency); path = NormalizePath(path); if (!comparer.Equals(path, _bootstrapPath)) { Log.LogError($"Bootstrap assembly {dependency.GetName().Name} incorrectly loaded from {path} instead of {_bootstrapPath}"); allGood = false; } } var failedLoads = s_failedLoadSet.Keys.ToList(); if (failedLoads.Count > 0) { foreach (var name in failedLoads.OrderBy(x => x.Name)) { Log.LogError($"Assembly resolution failed for {name}"); allGood = false; } } // The number chosen is arbitrary here. The goal of this check is to catch cases where a coding error has // broken our ability to use the compiler server in the bootstrap phase. // // It's possible on completely correct code for the server connection to fail. There could be simply // named pipe errors, CPU load causing timeouts, etc ... Hence flagging a single failure would produce // a lot of false positives. The current value was chosen as a reasonable number for warranting an // investigation. if (s_failedServerConnectionCount > 20) { Log.LogError($"Too many compiler server connection failures detected: {s_failedServerConnectionCount}"); allGood = false; } return allGood; }
/// <summary> /// Adds listeners to Trace that pass output into the given msbuild logger, making Trace /// calls visible in build output. VersionTools, for example, uses Trace. Returns the /// listeners to pass to RemoveMsBuildTraceListeners when the code using Trace is complete. /// </summary> public static MsBuildTraceListener[] AddMsBuildTraceListeners( this TraceListenerCollection listenerCollection, TaskLoggingHelper log) { var newListeners = new[] { TraceEventType.Error, TraceEventType.Warning, TraceEventType.Critical, TraceEventType.Information, TraceEventType.Verbose }.Select(t => new MsBuildTraceListener(log, t)).ToArray(); listenerCollection.AddRange(newListeners); return newListeners; }
public override bool Execute() { if (_bootstrapPath == null) { Log.LogError($"{nameof(ValidateBootstrap)} task must have a {nameof(BootstrapPath)} parameter."); return false; } var dependencies = new[] { typeof(ValidateBootstrap).GetTypeInfo().Assembly, }; var allGood = true; var comparer = StringComparer.OrdinalIgnoreCase; foreach (var dependency in dependencies) { var path = GetDirectory(dependency); path = NormalizePath(path); if (!comparer.Equals(path, _bootstrapPath)) { Log.LogError($"Bootstrap assembly {dependency.GetName().Name} incorrectly loaded from {path} instead of {_bootstrapPath}"); allGood = false; } } var failedLoads = s_failedLoadSet.Keys.ToList(); if (failedLoads.Count > 0) { foreach (var name in failedLoads.OrderBy(x => x.Name)) { Log.LogError($"Assembly resolution failed for {name}"); allGood = false; } } return allGood; }
public MSBuildLogger(Utils.TaskLoggingHelper log) { this.log = log; }