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]

@TheCodeTraveler TheCodeTraveler enabled auto-merge (squash) May 27, 2025 01:55
Copy link
Contributor

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 fixes the RS1038 warning by replacing dependency references and ensuring that the RS1038 rule is treated as an error during compilation.

  • Updated PackageReferences in multiple project files from Microsoft.CodeAnalysis.CSharp.Workspaces to Microsoft.CodeAnalysis.CSharp.
  • Added RS1038 to the warnings-as-errors configuration in Directory.Build.props.

Reviewed Changes

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

Show a summary per file
File Description
src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj Updated dependency reference as per RS1038 recommendation.
src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj Updated dependency reference as per RS1038 recommendation.
src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj Updated dependency reference as per RS1038 recommendation.
src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj Updated dependency reference as per RS1038 recommendation.
src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj Updated dependency reference as per RS1038 recommendation.
Directory.Build.props Added RS1038 rule to the warnings-as-errors and updated documentation for clarity.

@TheCodeTraveler TheCodeTraveler disabled auto-merge May 27, 2025 18:12
@TheCodeTraveler TheCodeTraveler merged commit f143391 into main May 27, 2025
8 of 10 checks passed
@TheCodeTraveler TheCodeTraveler deleted the Fix-RS1038 branch May 27, 2025 18:12
@github-actions github-actions bot locked and limited conversation to collaborators May 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant