Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash if there are diagnostics without spans #9290

Merged
merged 1 commit into from
Sep 16, 2023

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier commented Sep 15, 2023

Fixes 61% of https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1883434

The compiler will happily create diagnostics with a source span that is undefined (AbsoluteIndex of -1):
https://github.com/dotnet/razor/blob/main/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/RazorExtensionsDiagnosticFactory.cs#L26

Also snuck in a removal of one-allocation-per-diagnostic just because I'm in the mood.

@davidwengier davidwengier requested a review from a team as a code owner September 15, 2023 01:08
@davidwengier davidwengier merged commit bba88e8 into dotnet:main Sep 16, 2023
@ghost ghost added this to the Next milestone Sep 16, 2023
@davidwengier davidwengier deleted the FormattingPrismBug branch September 16, 2023 00:09
@Cosifne Cosifne modified the milestones: Next, 17.8 P3 Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants