-
Notifications
You must be signed in to change notification settings - Fork 364
Fix C# language version checks for [ObservableProperty]
#1140
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updated the ObservableProperty generator and diagnostics to allow usage with C# 14.0 or 'preview' language versions, not just 'preview'. Added a new helper method for language version comparison and updated diagnostic descriptors and analyzer logic to reflect the new minimum version requirement.
Created a new CommunityToolkit.Mvvm.SourceGenerators.Roslyn5000 project targeting netstandard2.0 and added it to the solution file.
Refactored the Roslyn 5000 project to import shared props and projitems files. Added support for the ROSLYN_5_0_0_OR_GREATER constant, updated NoWarn conditions for RS2003, and introduced a temporary workaround for Roslyn 5.0.0 versioning in the props file.
Revised the XML summary comment to clarify that the extension methods are for working with diagnostics from incremental generator pipelines, rather than specifically for GeneratorExecutionContext.
Added project references and packaging entries for Roslyn 5.0 source generators and code fixers to support analyzers for the latest Roslyn version.
Renamed RequiresCSharpLanguageVersionPreviewAnalyzer to RequiresCSharpLanguageVersion14OrPreviewAnalyzer and updated logic to check for C# 14.0 or preview language versions. Adjusted generator and unit tests to reference the new analyzer and updated version checks for compatibility with Roslyn 5.0.0 or greater.
Introduces CommunityToolkit.Mvvm.Roslyn5000.UnitTests.csproj targeting net472, net8.0, and net9.0. Updates the solution file to include the new test project for Roslyn 5.0.0 compatibility testing.
Added CommunityToolkit.Mvvm.SourceGenerators.Roslyn5000.UnitTests project to the solution and corrected the project reference in CommunityToolkit.Mvvm.csproj to point to the correct Roslyn5000 source generator. This enables testing for Roslyn 5.0.0 support.
Introduces new unit tests for ObservableProperty with value types on partial properties using C# 14 and Roslyn 5.0.0 or greater. Also updates formatting in diagnostics tests for consistency and readability.
Eliminated the temporary workaround for Roslyn 5.0.0 in the props file and updated the test project's Microsoft.CodeAnalysis.CSharp.Workspaces package reference from 5.0.0-2.final to 5.0.0. This aligns the configuration with the stable Roslyn release.
e5ce830 to
ab4e3c2
Compare
Changed the LangVersion property from 'preview' to '14.0' in the CommunityToolkit.Mvvm.Roslyn5000.UnitTests.csproj file to explicitly target C# 14.0 for test builds.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
analyzer 👓
A new analyzer being implemented or updated
bugfix 🔧
PRs fixing a discovered bug
mvvm-toolkit 🧰
Issues/PRs for the MVVM Toolkit
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the C# language checks when using partial properties, which need the new Roslyn version.
PR Checklist