Avoid null args when RazorDiagnostic does not have a message (#37648)
* Avoid null args when RazorDiagnostic does not have a message We've received tooling reports of the Razor compiler failing with a argument null exception when trying to format a diagnostic message. Unfortunately dumps don't have enough details to indicate what code path causes the badly formated argument to be used. Additonally, inspecting the code and turning on nullability in this code path does not suggest any obvious candidates in Razor's codebase. Tooling is working around this by try-catching the exception, but this results in squiggles / error items that do not disappear. This PR introduces a temporary workaround that prints a generic error message so that it does not crash VS / require tooling workarounds while we try and figure out the root cause. Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1405849
显示
- src/Razor/Microsoft.AspNetCore.Razor.Language/src/RazorDiagnosticDescriptor.cs 11 个添加, 2 个删除...spNetCore.Razor.Language/src/RazorDiagnosticDescriptor.cs
- src/Razor/Microsoft.AspNetCore.Razor.Language/src/Resources.resx 4 个添加, 1 个删除...or/Microsoft.AspNetCore.Razor.Language/src/Resources.resx
- src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorDiagnosticDescriptorTest.cs 13 个添加, 1 个删除...Core.Razor.Language/test/RazorDiagnosticDescriptorTest.cs
- src/Razor/Microsoft.AspNetCore.Razor.Language/test/RazorDiagnosticTest.cs 17 个添加, 1 个删除...oft.AspNetCore.Razor.Language/test/RazorDiagnosticTest.cs
想要评论请 注册 或 登录