I have a C# source generator that generates partial classes. It used to work 100% a couple of months ago for WPF AND non-WPF projects. But now that I am revisiting this, it no longer compiles if I have <UseWPF>true</UseWPF>
set in the csproj file. As soon as I have WPF enabled I get build errors suggesting my generated symbols are already defined (aka duplicate generation). The errors disappear if I disable WPF. This all used to work before and nothing has changed in my code since then.
How would I even go about investigating this? Might this be a bug in the dotnet SDK or may something have changed that causes me to have to update my generator?
This is a known issue present in .NET SDK 6.0.7 (more details here).
Here's a workaround that worked for me:
global.json
file next to your solution:{
"sdk": {
"version": "6.0.301",
"rollForward": "disable"
}
}