CommunityToolkit.Mvvm v8.4.0 Fails to Compile in Default .NET 10 Project Settings
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";
}
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
- [x] 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
This is expected, it's because we need to publish a new version of the MVVM Toolkit targeting the version of Roslyn supporting C# 14, but that's not available just yet. I've started working on things and will finish that up when the new dependencies are available 🙂
@Sergio0694 is there a ticket open for the roslyn team to publish that nuget package?
Don't think so, but they're working on it.
Also, as a temporary workaround, just set <LangVersion>preview</LangVersion> in your .csproj file 🙂
Don't think so, but they're working on it.
Also, as a temporary workaround, just set
<LangVersion>preview</LangVersion>in your .csproj file 🙂
Thanks for the response. I'm using the suggested workaround - however that does not really feel right, as it potentially allows me to use features I don't want to use right now (preview features). Waiting eagerly for the new release
Also, as a temporary workaround, just set
<LangVersion>preview</LangVersion>in your .csproj file 🙂
Please roll out an updated version that functions without relying on the language's preview feature.
Any news on this?
Hello @Sergio0694. Thank you for looking into this. Are there any news on this, please?