Skip to content

Conversation

@dibarbet
Copy link
Member

Resolves microsoft/vscode-dotnettools#2173

IDE diagnostic analyzers specifically go through a special path when reporting semantic diagnostics (different to other analyzers). This path had an old, bogus assert to verify that if the semantic diagnostic was in a file with no syntax tree (e.g. additional file), that also the project the file was in had no compilation (assuming it was a typescript project which has neither).

However this assert now gets hit because

  1. Source generator diagnostics are reported as semantic diagnostics via an IDE diagnostic analyzer (link).
  2. The Razor source generator reports diagnostics in additional files (the .razor file)

This change removes the assert as it doesn't appear to be necessary or valid.

@dibarbet dibarbet requested a review from a team as a code owner August 28, 2025 21:23
@dibarbet dibarbet enabled auto-merge August 28, 2025 22:34
@jasonmalinowski
Copy link
Member

@dibarbet I agree on your analysis the assert was suspect, given the caller absolutely knew the situation it was in...

@dibarbet dibarbet merged commit 05a936d into dotnet:main Aug 28, 2025
25 of 26 checks passed
@dibarbet dibarbet deleted the fix_sg_additional_file_diagnostic branch August 28, 2025 22:53
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Aug 28, 2025
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also approved :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constant errors when working with Razor files

4 participants