Fix incorrect version check order in MVVMToolkitRemoveDuplicateAnalyzers target - #1174
Merged
Merged
Conversation
…ers 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>
This was referenced Mar 25, 2026
Merged
evgenygunko
pushed a commit
to evgenygunko/CopyWordsDA
that referenced
this pull request
Mar 26, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [CommunityToolkit.Mvvm](https://github.com/CommunityToolkit/dotnet) | nuget | patch | `8.4.1` -> `8.4.2` | --- ### Release Notes <details> <summary>CommunityToolkit/dotnet (CommunityToolkit.Mvvm)</summary> ### [`v8.4.2`](https://github.com/CommunityToolkit/dotnet/releases/tag/v8.4.2): 8.4.2 #### What's Changed - Fix incorrect version check order in MVVMToolkitRemoveDuplicateAnalyzers target by [@​Sergio0694](https://github.com/Sergio0694) in CommunityToolkit/dotnet#1174 **Full Changelog**: CommunityToolkit/dotnet@v8.4.1...v8.4.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or PR is renamed to start with "rebase!". 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
This was referenced Aug 24, 2026
This was referenced Aug 31, 2026
Open
RootMeanSqr
pushed a commit
to RootMeanSqr/xsd-editor
that referenced
this pull request
Sep 4, 2026
Updated [CommunityToolkit.Mvvm](https://github.com/CommunityToolkit/dotnet) from 8.4.0 to 8.4.2. <details> <summary>Release notes</summary> _Sourced from [CommunityToolkit.Mvvm's releases](https://github.com/CommunityToolkit/dotnet/releases)._ ## 8.4.2 ## What's Changed * Fix incorrect version check order in MVVMToolkitRemoveDuplicateAnalyzers target by @Sergio0694 in CommunityToolkit/dotnet#1174 **Full Changelog**: CommunityToolkit/dotnet@v8.4.1...v8.4.2 ## 8.4.1 This release of the .NET Community Toolkit updates the MVVM Toolkit analyzers and source generator to Roslyn 5.0, so they can work with C# 14 out of the box. This means that `[ObservableProperty]` on partial properties no longer needs `preview` language version 🎉 ## What's Changed 🆕 * Migrate workflow to GitHub Actions by @Sergio0694 in CommunityToolkit/dotnet#1105 * Remove extra dash in `--no-build` argument in dotnet test invokation by @echoix in CommunityToolkit/dotnet#1132 * Bump unit tests from .NET 7 to .NET 9 by @Sergio0694 in CommunityToolkit/dotnet#1085 * Migrate solution to '.slnx' format by @Sergio0694 in CommunityToolkit/dotnet#1133 * Remove .NET 7 TFM by @Sergio0694 in CommunityToolkit/dotnet#1134 * fix object.Equals for EquatableArray by @JamesYFC in CommunityToolkit/dotnet#1120 * Handle 'CanExecute' with method overrides by @Sergio0694 in CommunityToolkit/dotnet#1081 * Migrate to new MSTest APIs to prepare for 4.0.x by @Sergio0694 in CommunityToolkit/dotnet#1136 * Update MSTest to latest by @Sergio0694 in CommunityToolkit/dotnet#1137 * Update NuGet packages and Windows SDK props by @Sergio0694 in CommunityToolkit/dotnet#1047 * Update to .NET 10 SDK, add .NET 10 TFM to test projects by @Sergio0694 in CommunityToolkit/dotnet#1144 * Fix C# language version checks for `[ObservableProperty]` by @Sergio0694 in CommunityToolkit/dotnet#1140 * Eliminate this = default shortcut when height * width = 0 by @marcin-krystianc in CommunityToolkit/dotnet#1130 * Support nested blocks in semi-auto property analyzer, add tests by @Youssef1313 in CommunityToolkit/dotnet#1025 * Update .NET SDK and NuGet dependencies by @Sergio0694 in CommunityToolkit/dotnet#1155 * Update Roslyn 5.0 analyzer and code fixer paths by @Sergio0694 in CommunityToolkit/dotnet#1156 * Update analyzers for C# 14.0 language version checks by @Sergio0694 in CommunityToolkit/dotnet#1159 * Fix deterministic builds, improve GitHub links by @Sergio0694 in CommunityToolkit/dotnet#1170 * Add MVVM Toolkit code fixer for Roslyn 5.0 by @Sergio0694 in CommunityToolkit/dotnet#1171 ## New Contributors * @echoix made their first contribution in CommunityToolkit/dotnet#1132 * @JamesYFC made their first contribution in CommunityToolkit/dotnet#1120 * @marcin-krystianc made their first contribution in CommunityToolkit/dotnet#1130 **Full Changelog**: CommunityToolkit/dotnet@v8.4.0...v8.4.1 Commits viewable in [compare view](CommunityToolkit/dotnet@v8.4.0...v8.4.2). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug
The
MVVMToolkitRemoveDuplicateAnalyzersWhenRoslynComponentVersioningIsNotSupportedtarget inCommunityToolkit.Mvvm.SourceGenerators.targetsselects the wrong Roslyn analyzer directory when the compiler version is >= 4.12 (e.g. Roslyn 5.0).In the
PropertyGroupthat determinesMVVMToolkitSelectedRoslynAnalyzerDirectoryName, MSBuild properties are evaluated top-to-bottom, with later assignments overwriting earlier ones. The>= 4.12check was placed before the>= 4.3check:For any Roslyn version >= 4.12 (including 5.0), both conditions are true, so the correct
roslyn4.12result is immediately overwritten byroslyn4.3. This causes theroslyn4.3analyzers to be passed to the compiler instead of the intendedroslyn4.12ones.Fix
Swap the order so the lower version threshold (
4.3) is checked first and the higher one (4.12) is checked last. This way, for Roslyn >= 4.12 the final (winning) assignment isroslyn4.12:PR Checklist
Other information
This was discovered by inspecting a binlog from a WinStore client app build using Roslyn 5.0. The
RemoveItem Analyzerstep was incorrectly removing theroslyn4.0androslyn4.12analyzers, leaving onlyroslyn4.3to be passed to the XAML compiler.