Skip to content
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

Closed
1 of 4 tasks
jamiehankins opened this issue Jul 12, 2022 · 13 comments
Closed
1 of 4 tasks
Labels
external ⤴️ Something related to or caused by an external project mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit

Comments

@jamiehankins
Copy link

jamiehankins commented Jul 12, 2022

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:

  1. Create a WPF exe project targeting net6.0-windows
  2. Reference CommunityToolkit.Mvvm like so:
    <PackageReference Include="CommunityToolkit.Mvvm" Version="7.1.2" />
  3. Create a simple class inheriting from ObservableObject, like so:
using CommunityToolkit.Mvvm.ComponentModel;

namespace ObservablePropertyTest
{
    public partial class TestVM : ObservableObject
    {
        [ObservableProperty]
        private string _testString = string.Empty;
    }
}

Expected Behavior:
In 17.2.5, it built and ran fine.

Actual Behavior:

Rebuild started...
1>------ Rebuild All started: Project: ObservablePropertyTest, Configuration: Debug Any CPU ------
Restored C:\git\ObservablePropertyTest\ObservablePropertyTest.csproj (in 2 ms).
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(12,27,12,70): error CS0101: The namespace 'CommunityToolkit.Mvvm.ComponentModel.__Internals' already contains a definition for '__KnownINotifyPropertyChangedOrChangingArgs'
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(7,6,7,51): error CS0579: Duplicate 'global::System.CodeDom.Compiler.GeneratedCode' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(8,6,8,52): error CS0579: Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(9,6,9,69): error CS0579: Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(10,6,10,51): error CS0579: Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(11,6,11,29): error CS0579: Duplicate 'global::System.Obsolete' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\ObservablePropertyTest.TestVM.cs(12,23,12,33): error CS0102: The type 'TestVM' already contains a definition for 'TestString'
1>Done building project "ObservablePropertyTest_yynlzhol_wpftmp.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

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

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

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

@jamiehankins jamiehankins added the bug 🐛 An unexpected issue that highlights incorrect behavior label Jul 12, 2022
@Sergio0694
Copy link
Member

@jamiehankins the generators in 7.1.2 are no longer supported, can you try using CommunityToolkit.Mvvm 8.0.0-Preview4 and seeing if that works? This is likely a bug on VS/Roslyn/WPF, but curious to see if the new generators trigger it as well 🙂

@Sergio0694 Sergio0694 added external ⤴️ Something related to or caused by an external project mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit and removed bug 🐛 An unexpected issue that highlights incorrect behavior labels Jul 13, 2022
@jamiehankins
Copy link
Author

@Sergio0694 8.0.0-Preview4 gives this:

1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs(11,27,11,61): error CS0101: The namespace 'CommunityToolkit.Mvvm.ComponentModel.__Internals' already contains a definition for '__KnownINotifyPropertyChangingArgs'
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs(11,27,11,60): error CS0101: The namespace 'CommunityToolkit.Mvvm.ComponentModel.__Internals' already contains a definition for '__KnownINotifyPropertyChangedArgs'
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\ObservablePropertyTest.TestVM.g.cs(29,22,29,42): error CS0756: A partial method may not have multiple defining declarations
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\ObservablePropertyTest.TestVM.g.cs(32,22,32,41): error CS0756: A partial method may not have multiple defining declarations
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs(6,6,6,51): error CS0579: Duplicate 'global::System.CodeDom.Compiler.GeneratedCode' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs(7,6,7,52): error CS0579: Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs(8,6,8,69): error CS0579: Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs(9,6,9,51): error CS0579: Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs(10,6,10,29): error CS0579: Duplicate 'global::System.Obsolete' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs(6,6,6,51): error CS0579: Duplicate 'global::System.CodeDom.Compiler.GeneratedCode' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs(7,6,7,52): error CS0579: Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs(8,6,8,69): error CS0579: Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs(9,6,9,51): error CS0579: Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs(10,6,10,29): error CS0579: Duplicate 'global::System.Obsolete' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\ObservablePropertyTest.TestVM.g.cs(11,23,11,33): error CS0102: The type 'TestVM' already contains a definition for 'TestString'
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\ObservablePropertyTest.TestVM.g.cs(29,22,29,42): error CS0111: Type 'TestVM' already defines a member called 'OnTestStringChanging' with the same parameter types
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\ObservablePropertyTest.TestVM.g.cs(32,22,32,41): error CS0111: Type 'TestVM' already defines a member called 'OnTestStringChanged' with the same parameter types

A little different, but still broken.

So 7.1.2 is the latest released version, but it's not supported?
Only the version that hasn't been released is 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.

@Kumnaa
Copy link

Kumnaa commented Jul 13, 2022

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

@borosbence
Copy link

borosbence commented Jul 13, 2022

Updated to 8.0.0-preview4 and still got erros on generated files. Visual Studio version: 17.2.6.

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0111	Type '__IMessengerExtensions' already defines a member called 'CreateAllMessagesRegistrator' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\WebBackup.WPF.ViewModels.MainViewModel.g.cs	9	Active
Error	CS0111	Type '__IMessengerExtensions' already defines a member called 'CreateAllMessagesRegistratorWithToken' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\WebBackup.WPF.ViewModels.MainViewModel.g.cs	22	Active
Error	CS0111	Type '__IMessengerExtensions' already defines a member called 'CreateAllMessagesRegistrator' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.g.cs	9	Active
Error	CS0111	Type '__IMessengerExtensions' already defines a member called 'CreateAllMessagesRegistratorWithToken' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.g.cs	22	Active
Error	CS0579	Duplicate 'global::System.CodeDom.Compiler.GeneratedCode' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\__IMessengerExtensions.g.cs	5	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\__IMessengerExtensions.g.cs	6	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\__IMessengerExtensions.g.cs	7	Active
Error	CS0579	Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\__IMessengerExtensions.g.cs	8	Active
Error	CS0579	Duplicate 'global::System.Obsolete' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\__IMessengerExtensions.g.cs	9	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.IMessengerRegisterAllGenerator\__IMessengerExtensions.g.cs	10	Active
Error	CS0102	The type 'MainViewModel' already contains a definition for 'WebsiteCount'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.MainViewModel.g.cs	11	Active
Error	CS0111	Type 'MainViewModel' already defines a member called 'OnWebsiteCountChanging' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.MainViewModel.g.cs	29	Active
Error	CS0756	A partial method may not have multiple defining declarations	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.MainViewModel.g.cs	29	Active
Error	CS0111	Type 'MainViewModel' already defines a member called 'OnWebsiteCountChanged' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.MainViewModel.g.cs	32	Active
Error	CS0756	A partial method may not have multiple defining declarations	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.MainViewModel.g.cs	32	Active
Error	CS0102	The type 'WebsiteFormViewModel' already contains a definition for 'Title'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	11	Active
Error	CS0111	Type 'WebsiteFormViewModel' already defines a member called 'OnTitleChanging' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	29	Active
Error	CS0756	A partial method may not have multiple defining declarations	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	29	Active
Error	CS0111	Type 'WebsiteFormViewModel' already defines a member called 'OnTitleChanged' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	32	Active
Error	CS0756	A partial method may not have multiple defining declarations	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	32	Active
Error	CS0102	The type 'WebsitesViewModel' already contains a definition for 'SelectedWebsite'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.g.cs	11	Active
Error	CS0111	Type 'WebsitesViewModel' already defines a member called 'OnSelectedWebsiteChanging' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.g.cs	29	Active
Error	CS0756	A partial method may not have multiple defining declarations	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.g.cs	29	Active
Error	CS0111	Type 'WebsitesViewModel' already defines a member called 'OnSelectedWebsiteChanged' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.g.cs	32	Active
Error	CS0756	A partial method may not have multiple defining declarations	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.g.cs	32	Active
Error	CS0579	Duplicate 'global::System.CodeDom.Compiler.GeneratedCode' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs	6	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs	7	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs	8	Active
Error	CS0579	Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs	9	Active
Error	CS0579	Duplicate 'global::System.Obsolete' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs	10	Active
Error	CS0101	The namespace 'CommunityToolkit.Mvvm.ComponentModel.__Internals' already contains a definition for '__KnownINotifyPropertyChangedArgs'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedArgs.g.cs	11	Active
Error	CS0579	Duplicate 'global::System.CodeDom.Compiler.GeneratedCode' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs	6	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs	7	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs	8	Active
Error	CS0579	Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs	9	Active
Error	CS0579	Duplicate 'global::System.Obsolete' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs	10	Active
Error	CS0101	The namespace 'CommunityToolkit.Mvvm.ComponentModel.__Internals' already contains a definition for '__KnownINotifyPropertyChangingArgs'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangingArgs.g.cs	11	Active
Error	CS0102	The type 'WebsiteFormViewModel' already contains a definition for 'Messenger'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableRecipientGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	13	Active
Error	CS0102	The type 'WebsiteFormViewModel' already contains a definition for 'isActive'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableRecipientGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	16	Active
Error	CS0102	The type 'WebsiteFormViewModel' already contains a definition for 'IsActive'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableRecipientGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	22	Active
Error	CS0111	Type 'WebsiteFormViewModel' already defines a member called 'OnActivated' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableRecipientGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	49	Active
Error	CS0111	Type 'WebsiteFormViewModel' already defines a member called 'OnDeactivated' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableRecipientGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	60	Active
Error	CS0111	Type 'WebsiteFormViewModel' already defines a member called 'Broadcast' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableRecipientGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	79	Active
Error	CS0111	Type '__ObservableValidatorExtensions' already defines a member called 'CreateAllPropertiesValidator' with the same parameter types	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableValidatorValidateAllPropertiesGenerator\WebBackup.WPF.ViewModels.WebsiteFormViewModel.g.cs	9	Active
Error	CS0579	Duplicate 'global::System.CodeDom.Compiler.GeneratedCode' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableValidatorValidateAllPropertiesGenerator\__ObservableValidatorExtensions.g.cs	5	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableValidatorValidateAllPropertiesGenerator\__ObservableValidatorExtensions.g.cs	6	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableValidatorValidateAllPropertiesGenerator\__ObservableValidatorExtensions.g.cs	7	Active
Error	CS0579	Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableValidatorValidateAllPropertiesGenerator\__ObservableValidatorExtensions.g.cs	8	Active
Error	CS0579	Duplicate 'global::System.Obsolete' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableValidatorValidateAllPropertiesGenerator\__ObservableValidatorExtensions.g.cs	9	Active
Error	CS0579	Duplicate 'global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' attribute	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservableValidatorValidateAllPropertiesGenerator\__ObservableValidatorExtensions.g.cs	10	Active
Error	CS0102	The type 'WebsitesViewModel' already contains a definition for 'deleteCommand'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.DeleteAsync.g.cs	10	Active
Error	CS0102	The type 'WebsitesViewModel' already contains a definition for 'DeleteCommand'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.DeleteAsync.g.cs	14	Active
Error	CS0102	The type 'WebsitesViewModel' already contains a definition for 'showWebsiteCommand'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.ShowWebsite.g.cs	10	Active
Error	CS0102	The type 'WebsitesViewModel' already contains a definition for 'ShowWebsiteCommand'	WebBackup.WPF	D:\Documents\Visual Studio 2022\Repos\Website-Backup\src\WebBackup.WPF\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator\WebBackup.WPF.ViewModels.WebsitesViewModel.ShowWebsite.g.cs	14	Active

@Sergio0694
Copy link
Member

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? 🤔

@Kumnaa
Copy link

Kumnaa commented Jul 13, 2022

This has also been raised on the dotnet/sdk repository:

dotnet/sdk#26542

@Tum4ik
Copy link

Tum4ik commented Jul 13, 2022

A workaround is here dotnet/wpf#6792.

@hymccord
Copy link
Contributor

hymccord commented Jul 14, 2022

Here's the direct link to the recommended workaround: dotnet/wpf#6792 (comment)

Put that in either your csproj or a Directory.Build.targets file.

@Sergio0694
Copy link
Member

Now that VS 17.3 is out, can anyone confirm whether this is fixed?
Or is the WPF fix not out yet and this wasn't actually related to VS 17.2.6 itself? 🤔

@chen249045216
Copy link

Now that VS 17.3 is out, can anyone confirm whether this is fixed? Or is the WPF fix not out yet and this wasn't actually related to VS 17.2.6 itself? 🤔
it's not fixed. i'm using the VS 17.3

@r-work
Copy link

r-work commented Sep 8, 2022

Using VS 17.4 Preview 1.0, not fixed.

@bigmarkoberg
Copy link

I read somewhere, not sure where, that when 6.0.9 of the .NET SDK comes out, it'll be there.
Possibly from here dotnet/wpf#6792

SDK Downloads
https://dotnet.microsoft.com/en-us/download/dotnet/6.0

@Sergio0694 Sergio0694 mentioned this issue Sep 12, 2022
4 tasks
@Sergio0694
Copy link
Member

This is now fixed! 🎉🎉🎉

See https://devblogs.microsoft.com/dotnet/september-2022-updates/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external ⤴️ Something related to or caused by an external project mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit
Projects
None yet
Development

No branches or pull requests

9 participants