Skip to content

Conversation

@TheCodeTraveler
Copy link
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

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-->

@TheCodeTraveler TheCodeTraveler enabled auto-merge (squash) May 27, 2025 01:55
@TheCodeTraveler TheCodeTraveler disabled auto-merge May 27, 2025 18:12
@TheCodeTraveler TheCodeTraveler merged commit 77d616d into main May 27, 2025
10 checks passed
@TheCodeTraveler TheCodeTraveler deleted the Fix-RS1038-Compiler-extensions-should-be-implemented-in-assemblies-with-compiler-provided-references branch May 27, 2025 18:13
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.

1 participant