Skip to content

Fix RS1038 Warning: Compiler extensions should be implemented in assemblies with compiler-provided references#390

Merged
TheCodeTraveler merged 1 commit intomainfrom
Fix-RS1038-Compiler-extensions-should-be-implemented-in-assemblies-with-compiler-provided-references
May 27, 2025
Merged

Fix RS1038 Warning: Compiler extensions should be implemented in assemblies with compiler-provided references#390
TheCodeTraveler merged 1 commit intomainfrom
Fix-RS1038-Compiler-extensions-should-be-implemented-in-assemblies-with-compiler-provided-references

Conversation

@TheCodeTraveler
Copy link
Copy Markdown
Collaborator

Description of Change

This PR adds RS1038 to <WarningsAsErrors> and replaces Microsoft.CodeAnalysis.CSharp.Workspaces -> Microsoft.CodeAnalysis.CSharp

Link to RS1038 Docs:
https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md

Additional information

Link to Compiler Warnings seen in CommunityToolkit.Maui: https://github.com/CommunityToolkit/Maui/actions/runs/15263232470/job/42928522628#step:14:61

Warning: D:\a\Maui\Maui\src\CommunityToolkit.Maui.Analyzers\UseCommunityToolkitInitializationAnalyzer.cs(9,2): warning RS1038: This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md) [D:\a\Maui\Maui\src\CommunityToolkit.Maui.Analyzers\CommunityToolkit.Maui.Analyzers.csproj]

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures compliance with the RS1038 analyzer by removing the workspaces package reference and treating RS1038 as an error.

  • Swap Microsoft.CodeAnalysis.CSharp.Workspaces for Microsoft.CodeAnalysis.CSharp at 4.14.0
  • Add RS1038 to the <WarningsAsErrors> list and adjust the surrounding XML comment

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/CommunityToolkit.Maui.Markup.SourceGenerators/CommunityToolkit.Maui.Markup.SourceGenerators.csproj Replaced Microsoft.CodeAnalysis.CSharp.Workspaces with Microsoft.CodeAnalysis.CSharp
Directory.Build.props Added RS1038 to WarningsAsErrors and moved the XML comment closing tag
Comments suppressed due to low confidence (1)

Directory.Build.props:70

  • The XML comment closing marker (-->) is on the same line as the RS1038 entry; please verify that the opening <!-- is correctly paired so that the warning entry is not accidentally commented out or causing an XML parse error.
RS1038: Compiler extensions should be implemented in assemblies with compiler-provided references-->

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.

2 participants