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

Error when users use a file type for things we need to load #7501

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

333fred
Copy link
Member

@333fred 333fred commented Dec 10, 2024

Inspired by dotnet/roslyn#76355. file types can cause errors on .NET Framework hosts, and we should just prevent these from being used. The purpose of file types is to not be visible outside the current file, and the purpose of analyzers is to be loaded by some other plugin system. These goals are mutually exclusive.

Inspired by dotnet/roslyn#76355. `file` types can cause errors on .NET Framework hosts, and we should just prevent these from being used. The purpose of `file` types is to not be visible outside the current file, and the purpose of analyzers is to be loaded by some other plugin system. These goals are mutually exclusive.
@333fred 333fred requested a review from a team as a code owner December 10, 2024 20:37
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 95.41985% with 6 lines in your changes missing coverage. Please review.

Project coverage is 96.50%. Comparing base (7f449a5) to head (ce70a57).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #7501    +/-   ##
========================================
  Coverage   96.50%   96.50%            
========================================
  Files        1450     1452     +2     
  Lines      347435   347566   +131     
  Branches    11413    11416     +3     
========================================
+ Hits       335297   335426   +129     
- Misses       9245     9246     +1     
- Partials     2893     2894     +1     

Copy link
Member

@sharwell sharwell left a comment

Choose a reason for hiding this comment

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

This seems more like a compiler bug than an analyzer issue, but can maybe be mitigated here. Would recommend the compiler report a better error for the scenario, as users who encounter the problem will not be able to make the connection between the current error and this change.

CreateLocalizableResourceString(nameof(DoNotUseFileTypesForAnalyzersOrGeneratorsTitle)),
CreateLocalizableResourceString(nameof(DoNotUseFileTypesForAnalyzersOrGeneratorsMessage)),
DiagnosticCategory.MicrosoftCodeAnalysisCorrectness,
DiagnosticSeverity.Error,
Copy link
Member

Choose a reason for hiding this comment

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

Severity should be warning

Copy link
Member Author

Choose a reason for hiding this comment

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

If this is an error, then users do not need to make a connection between a compiler load failure and a warning.

@333fred 333fred merged commit 5ed3367 into dotnet:main Dec 16, 2024
11 checks passed
@333fred 333fred deleted the file-type-analyzer branch December 16, 2024 18:49
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.

5 participants