BackEnd\Components\Logging\BuildErrorTelemetryTracker.cs (54)
49private readonly int[] _errorCounts = new int[(int)ErrorCategory.Count];
54private ErrorCategory _primaryCategory;
69ErrorCategory category = CategorizeError(errorCode, subcategory);
95Compiler: GetCountOrNull(ErrorCategory.Compiler),
96MsBuildGeneral: GetCountOrNull(ErrorCategory.MSBuildGeneral),
97MsBuildEvaluation: GetCountOrNull(ErrorCategory.MSBuildEvaluation),
98MsBuildExecution: GetCountOrNull(ErrorCategory.MSBuildExecution),
99MsBuildGraph: GetCountOrNull(ErrorCategory.MSBuildGraph),
100Task: GetCountOrNull(ErrorCategory.Tasks),
101SdkResolvers: GetCountOrNull(ErrorCategory.SDKResolvers),
102NetSdk: GetCountOrNull(ErrorCategory.NETSDK),
103NuGet: GetCountOrNull(ErrorCategory.NuGet),
104BuildCheck: GetCountOrNull(ErrorCategory.BuildCheck),
105NativeToolchain: GetCountOrNull(ErrorCategory.NativeToolchain),
106CodeAnalysis: GetCountOrNull(ErrorCategory.CodeAnalysis),
107Razor: GetCountOrNull(ErrorCategory.Razor),
108Wpf: GetCountOrNull(ErrorCategory.WPF),
109AspNet: GetCountOrNull(ErrorCategory.AspNet),
110Other: GetCountOrNull(ErrorCategory.Other));
123private int? GetCountOrNull(ErrorCategory category)
134private static ErrorCategory CategorizeError(string? errorCode, string? subcategory)
138return ErrorCategory.Other;
144return ErrorCategory.Compiler;
150return ErrorCategory.Compiler;
155return ErrorCategory.Other;
165('A', 'S') when StartsWithASP(errorCode) => ErrorCategory.AspNet,
168('B', 'C') => ErrorCategory.BuildCheck,
169('B', 'L') => ErrorCategory.AspNet, // Blazor
172('C', 'A') => ErrorCategory.CodeAnalysis,
173('C', 'L') => ErrorCategory.NativeToolchain,
174('C', 'V') when errorCode.Length >= 3 && char.ToUpperInvariant(errorCode[2]) == 'T' => ErrorCategory.NativeToolchain, // CVT*
175('C', >= '0' and <= '9') => ErrorCategory.NativeToolchain, // C1*, C2*, C4* (C/C++ compiler)
178('I', 'D') when errorCode.Length >= 3 && char.ToUpperInvariant(errorCode[2]) == 'E' => ErrorCategory.CodeAnalysis, // IDE*
181('L', 'N') when errorCode.Length >= 3 && char.ToUpperInvariant(errorCode[2]) == 'K' => ErrorCategory.NativeToolchain, // LNK*
184('M', 'C') => ErrorCategory.WPF, // MC* (Markup Compiler)
186('M', 'T') => ErrorCategory.NativeToolchain, // MT* (Manifest Tool)
189('N', 'E') when StartsWithNETSDK(errorCode) => ErrorCategory.NETSDK,
190('N', 'U') => ErrorCategory.NuGet,
193('R', 'C') => ErrorCategory.NativeToolchain, // RC* (Resource Compiler)
194('R', 'Z') => ErrorCategory.Razor,
197('X', 'C') => ErrorCategory.WPF, // XC* (XAML Compiler)
199_ => ErrorCategory.Other
248private static ErrorCategory CategorizeMSBError(ReadOnlySpan<char> codeSpan)
253return ErrorCategory.Other;
258>= 3001 and <= 3999 => ErrorCategory.Tasks,
259>= 4001 and <= 4099 => ErrorCategory.MSBuildGeneral,
260>= 4100 and <= 4199 => ErrorCategory.MSBuildEvaluation,
261>= 4200 and <= 4299 => ErrorCategory.SDKResolvers,
262>= 4300 and <= 4399 => ErrorCategory.MSBuildExecution,
263>= 4400 and <= 4499 => ErrorCategory.MSBuildGraph,
264>= 4500 and <= 4999 => ErrorCategory.MSBuildGeneral,
265>= 5001 and <= 5999 => ErrorCategory.MSBuildExecution,
266>= 6001 and <= 6999 => ErrorCategory.MSBuildExecution,
267_ => ErrorCategory.Other