-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CommunityToolKit.Mvvm source generators run twice on Visual Studio 17.2.6 #343
Comments
@jamiehankins the generators in 7.1.2 are no longer supported, can you try using |
@Sergio0694 8.0.0-Preview4 gives this:
A little different, but still broken. So 7.1.2 is the latest released version, but it's not supported? That's a little scary. The recommendation is to use preview code in production, or should this library not be considered production ready? It looks like msbuild is including your analyzer DLL twice in the csc command line, so almost certainly something the VS guys will fix. The fact that the villagers aren't surrounding the castle with pitchforks and torches yet tells me that this lib must not be getting a ton of use yet. |
Not much to add other than I'm getting the same using both Rider and 'dotnet build' from the command line with 8.0.0-Preview4 |
Updated to 8.0.0-preview4 and still got erros on generated files. Visual Studio version: 17.2.6.
|
Hey @chsienki, this seems possibly related to the WPF issues in dotnet/roslyn#158, could this be a regression in a recent VS build? I'm aware the source generators never played well with WPF, but they've only ever caused issues such as not showing up properly in IntelliSense or the designer, but never something like this. Do you have any thoughts on this? 🤔 |
This has also been raised on the dotnet/sdk repository: |
A workaround is here dotnet/wpf#6792. |
Here's the direct link to the recommended workaround: dotnet/wpf#6792 (comment) Put that in either your csproj or a |
Now that VS 17.3 is out, can anyone confirm whether this is fixed? |
|
Using VS 17.4 Preview 1.0, not fixed. |
I read somewhere, not sure where, that when 6.0.9 of the .NET SDK comes out, it'll be there. SDK Downloads |
This is now fixed! 🎉🎉🎉 See https://devblogs.microsoft.com/dotnet/september-2022-updates/. |
Describe the bug
On Visual Studio 17.2.6, it appears that your source generators run twice, resulting in a duplicate attribute error.
This worked in 17.2.5, so it's not likely your bug, but it fundamentally breaks your code, so it's in your best interest to apply pressure to the VS folks to fix it or help you to mitigate it.
Steps to reproduce
This is a copy of my report in the Roslyn database:
dotnet/wpf#6792
Version Used: 17.2.6
Steps to Reproduce:
net6.0-windows
<PackageReference Include="CommunityToolkit.Mvvm" Version="7.1.2" />
ObservableObject
, like so:Expected Behavior:
In 17.2.5, it built and ran fine.
Actual Behavior:
It appears that somehow the CommunityToolkit.Mvvm source generators are being run twice.
If you create a WPF class library, things work fine. They're only broken in a WPF app.
Expected behavior
Project builds and runs.
IDE and version
VS 2022
IDE version
17.2.6
Nuget packages
Nuget package version(s)
7.1.2
Additional context
I realize this is probably not a bug in this package. However, it's possible that it is and whatever change happened between VS2022 17.2.5 and 17.2.6 exposed it. Either way, as an internal team, you're in a position to talk to the appropriate people to get this resolved quickly.
Help us help you
No, just wanted to report this
The text was updated successfully, but these errors were encountered: