Skip to content

CommunityToolkit.Mvvm v8.4.0 Fails to Compile in Default .NET 10 Project Settings #1139

@ali50m

Description

@ali50m

Describe the bug

I have installed the new released .NET 10 SDK and created a new .NET 10 project.

After installing the CommunityToolkit.Mvvm v8.4.0 NuGet package, the project fails to build using the default project settings.

The compilation errors observed are:

MVVMTK0041 (Error related to the MVVM Toolkit Source Generator)

CS9248 and/or CS8050 (C# language version compatibility errors, suggesting a new C# feature is being used without adequate language support configured).

Workaround / Required Fix:

To resolve these errors and successfully compile the project with CommunityToolkit.Mvvm v8.4.0, I am required to explicitly set the LangVersion property to preview in the project file.

code:
Net10MvvmLib.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <!--<LangVersion>preview</LangVersion>-->
    <LangVersion>14.0</LangVersion>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
  </ItemGroup>
</Project>

Person.cs

using CommunityToolkit.Mvvm.ComponentModel;

namespace Net10MvvmLib;

internal partial class Person : ObservableObject
{
    [ObservableProperty]
    public partial string Name { get; set; } = "John";
}
Image

Regression

No response

Steps to reproduce

env:
Win 10.0.19044
dotnet SDK 10.0.100
visual studio 18.0.0

Expected behavior

Work properly.

Screenshots

No response

IDE and version

Other

IDE version

vs 2026 community

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.4.0

Additional context

No response

Help us help you

No, just wanted to report this

Metadata

Metadata

Assignees

No one assigned

    Labels

    analyzer 👓A new analyzer being implemented or updatedbug 🐛An unexpected issue that highlights incorrect behaviormvvm-toolkit 🧰Issues/PRs for the MVVM Toolkit

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions