Commit Graph
283 Commits
Author SHA1 Message Date
Sergio PedriandCopilot 02d81da64b Fix incorrect version check order in MVVMToolkitRemoveDuplicateAnalyzers target
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>
2026-03-24 14:57:02 -07:00
Sergio Pedri 403b96541d Include Roslyn5000 code fixers and analyzer
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.
2026-03-16 17:28:10 -07:00
Sergio Pedri bdd4567f9b Use Roslyn API for C# language-version check
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.
2026-03-16 17:27:01 -07:00
Sergio Pedri e7a54bd5c3 Import shared props in Roslyn5000 project
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.
2026-03-16 17:25:28 -07:00
Sergio Pedri b4537625a2 Add Roslyn5000 CodeFixers project to solution
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.
2026-03-16 17:22:30 -07:00
Sergio Pedri 223fb36f1d Add reproducible builds pkg; remove embedded PDB
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.
2026-03-16 10:26:45 -07:00
Sergio Pedri ee5e84a75d Update analyzers for C# 14.0 language version checks
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.
2026-01-27 16:16:22 -08:00
Sergio Pedri d395f9f858 Update Roslyn 5.0 analyzer path
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.
2026-01-13 11:08:43 -08:00
Sergio Pedri 2a86742667 Update package dependencies to latest versions
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.
2026-01-12 13:33:27 -08:00
Sergio Pedri b3c0266aec Handle nested block operations in analyzer
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.
2025-11-24 15:39:18 -08:00
Marcin Krystianc 8323145328 Eliminate this = default shortcut when height * width = 0 2025-11-24 14:52:57 -08:00
Sergio Pedri ab4e3c21ac Remove Roslyn 5.0.0 workaround and update test dependency
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.
2025-11-24 14:28:58 -08:00
Sergio Pedri dffc56d7ee Add Roslyn5000 unit test project and fix project reference
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.
2025-11-24 14:28:58 -08:00
Sergio Pedri 272a9749a7 Update analyzer for C# 14.0 language version support
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.
2025-11-24 14:28:58 -08:00
Sergio Pedri 6ae2439606 Add Roslyn 5.0 source generator and code fixer support
Added project references and packaging entries for Roslyn 5.0 source generators and code fixers to support analyzers for the latest Roslyn version.
2025-11-24 14:28:58 -08:00
Sergio Pedri 8f23f79c18 Update summary for DiagnosticsExtensions class
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.
2025-11-24 14:28:58 -08:00
Sergio Pedri 55f39c2d75 Update Roslyn 5.0 support in source generators
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.
2025-11-24 14:28:58 -08:00
Sergio Pedri c62a26480b Add Roslyn5000 source generator project to solution
Created a new CommunityToolkit.Mvvm.SourceGenerators.Roslyn5000 project targeting netstandard2.0 and added it to the solution file.
2025-11-24 14:28:58 -08:00
Sergio Pedri 8b54ba568c Add C# 14.0 support for ObservableProperty on partial properties
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.
2025-11-24 14:28:58 -08:00
Sergio Pedri 07062f4301 Update to .NET SDK 10 and revise toolkit requirements
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.
2025-11-24 13:52:06 -08:00
Sergio Pedri 5f2f8174fb Update NuGet packages to latest stable 2025-11-10 12:20:12 -08:00
Sergio Pedri 85d26bf421 Update NuGet packages to latest stable 2025-11-10 12:17:43 -08:00
Sergio Pedri 013b10cd71 Update NuGet packages to latest stable 2025-11-10 11:56:58 -08:00
Sergio Pedri 9be2ae6ee7 Update NuGet packages to latest stable 2025-11-10 11:55:49 -08:00
Sergio Pedri 38c6f4a899 Update CsWinRT references 2025-11-10 11:54:56 -08:00
Sergio Pedri 1abeff602b Mark more members as 'readonly' 2025-11-10 11:54:56 -08:00
Sergio Pedri 7d4d6ec84b Handle 'CanExecute' with method overrides 2025-11-06 10:33:29 -08:00
Sergio Pedri 95043f57b3 Merge pull request #1120 from JamesYFC/fix/equatable-array-equals
fix object.Equals for EquatableArray
2025-11-06 10:33:16 -08:00
Sergio Pedri 77149455ba Update codebase to target .NET 8.0 and remove .NET 7.0
Replaces all conditional compilation checks for NET7_0_OR_GREATER with NET8_0_OR_GREATER and removes .NET 7.0 from the target frameworks in the project file. This ensures the codebase is aligned with .NET 8.0 features and APIs, simplifying maintenance and leveraging the latest platform improvements.
2025-11-05 20:27:11 -08:00
James 235bf81c15 fix object.Equals for EquatableArray 2025-11-05 20:07:35 -08:00
Sergio Pedri 3c720ddf7b Handle semi-auto properties with expression bodies 2024-12-11 22:33:27 -08:00
Sergio Pedri 6cf850fe38 Improve filtering in semi-auto property analyzer 2024-12-11 16:17:08 -08:00
Sergio Pedri 576646598c Enable pooling for objects in new analyzer 2024-12-10 22:17:15 -08:00
Sergio Pedri a1bfe3d7f7 Port 'ObjectPool<T>' type from Roslyn 2024-12-10 21:49:22 -08:00
Sergio Pedri 76c41aa32c Move MVVMTK0056 to 8.4.0 release 2024-12-10 20:13:46 -08:00
Sergio Pedri a91e7a8b48 Handle adding using directives if needed 2024-12-10 20:13:46 -08:00
Sergio Pedri df714eaa6c Add support for 'get;' accessors too 2024-12-10 20:13:46 -08:00
Sergio Pedri da8901493f Fix leading trivia in accessors, add tests 2024-12-10 20:13:46 -08:00
Sergio Pedri e3489068a9 Only remove leading trivia, add tests 2024-12-10 20:13:46 -08:00
Sergio Pedri 5e3d65fede Improve handling of attribute lists, fix tests 2024-12-10 20:13:46 -08:00
Youssef1313 71aeda87f6 Fix failing test 2024-12-10 20:13:46 -08:00
Sergio Pedri 162ae4f24c Add 'UsePartialPropertyForSemiAutoPropertyCodeFixer' 2024-12-10 20:13:46 -08:00
Sergio Pedri fc429245ff Add 'UseObservablePropertyOnSemiAutoPropertyAnalyzer' 2024-12-10 20:13:46 -08:00
Sergio Pedri a6f517ea9e Support explicit properties in [GBCP] attribute 2024-12-06 18:55:40 -08:00
Sergio Pedri 2c4be6618a Update recommended Windows SDK packages 2024-12-05 09:27:41 -08:00
Sergio Pedri a8aaeb57e9 Update NuGet packages to latest stable 2024-12-05 09:27:31 -08:00
Sergio Pedri a35944f359 Remove leftover 'required' handling code 2024-12-05 08:46:26 -08:00
Sergio Pedri d5f3a0c8fd Add 'InvalidPointerTypeObservablePropertyAttributeAnalyzer' 2024-12-05 08:46:26 -08:00
Sergio Pedri fc975d1026 Generalize forwarding all property modifiers 2024-12-05 00:40:56 -08:00
Sergio Pedri 889cc08072 Fix consistency for 'new()' for diagnostics/suppressions 2024-12-02 16:52:02 -08:00