MSBuild PropertyGroup elements are evaluated top-to-bottom, with later
assignments overwriting earlier ones. The >= 4.12 check was before the
>= 4.3 check, so for any Roslyn version >= 4.12 (including 5.0), the
4.12 result would be immediately overwritten by the 4.3 match. This
caused the wrong analyzer (roslyn4.3) to be selected instead of the
correct one (roslyn4.12).
Swap the order so the lower version (4.3) is checked first and the
higher version (4.12) is checked last, ensuring the highest compatible
analyzer wins.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update unit tests to run against different C# language versions: add DataRow(LanguageVersion.Preview) to each test and, under ROSLYN_5_0_0_OR_GREATER, add DataRow(LanguageVersion.CSharp14). Change test methods to accept a LanguageVersion parameter and use it when constructing CSharpCodeFixTest (replace hardcoded LanguageVersion.Preview). Conditional compilation preserves compatibility with older Roslyn targets.
Add a ProjectReference to CommunityToolkit.Mvvm.CodeFixers.Roslyn5000 (ReferenceOutputAssembly="false") and update the packaged analyzer entry for roslyn5.0 to point at the Roslyn5000 DLL. This ensures the Roslyn 5.0 code fixers are built and included in the package analyzers folder for roslyn5.0 compatibility.
Use the Roslyn 5+ API when available to determine the C# language version. Add a conditional compilation branch that calls Compilation.HasLanguageVersionAtLeastEqualTo(LanguageVersion.CSharp14) when ROSLYN_5_0_0_OR_GREATER is defined, and fall back to the previous IsLanguageVersionPreview() check otherwise. This avoids generating invalid code on older Roslyn builds while correctly detecting C#14+ in newer toolchains.
Replace inline project properties in the Roslyn5000 csproj with imports of the shared props and projitems to centralize configuration. Also add a new conditional DefineConstants in CommunityToolkit.Mvvm.CodeFixers.props to define ROSLYN_5_0_0_OR_GREATER when MvvmToolkitSourceGeneratorRoslynVersion >= 5.0.0, enabling feature flags for Roslyn 5.0.
Add a new CommunityToolkit.Mvvm.CodeFixers.Roslyn5000.csproj targeting net10.0 with ImplicitUsings and Nullable enabled, and include the project in dotnet.slnx. This adds a Roslyn5000-specific CodeFixers project to the solution so it can be built and discovered by the solution tooling.
Add DotNet.ReproducibleBuilds (with comment) alongside Nerdbank.GitVersioning to enable reproducible build tooling. Remove the explicit PublishRepositoryUrl setting from Directory.Build.props. Drop the ContinuousIntegrationBuild property from build/Community.Toolkit.Common.props. Remove forced DebugType=embedded and associated comments from the source generator and codefixer props, reverting to default PDB handling for those projects.
Introduces new unit tests under the ROSLYN_5_0_0_OR_GREATER conditional to verify analyzer diagnostics and code generation behavior when using C# 14. These tests ensure correct warnings are produced for observable properties and WinRT compatibility in this language version.
Replaced preview language version checks with explicit C# 14.0 or greater checks using HasLanguageVersionAtLeastEqualTo when available. This ensures analyzers correctly handle new language versioning and maintain compatibility with Roslyn 5.0.0 or greater.
Changed the source generator reference for Roslyn 5.0 to use the Roslyn5000 projects instead of Roslyn4120, ensuring the correct analyzer DLL is packaged for Roslyn 5.0.
Bump Microsoft.Bcl.AsyncInterfaces, System.Text.Json, and System.Formats.Asn1 to version 10.0.1 in main and test projects to address security and compatibility improvements.
Adds support for analyzing nested block operations in 'get' accessors, improving compatibility with code generated by other tooling. The analyzer now correctly identifies return operations within nested blocks.
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.
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.
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.
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 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.
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.
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.
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.
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.
Bump .NET SDK version to 10.0.100 in global.json and update NuGet operations to use 10.0.x in CI workflow. Simplify MVVM Toolkit error message to recommend using the latest .NET SDK version.
Moved the ParallelizeAttribute configuration from individual test project files to the shared Community.Toolkit.Common.targets file. This centralizes the configuration and ensures all test projects run tests in parallel by default.