Sergio0694/PolySharp

project with polysharp does not compile

Randle-Lanre opened this issue · 1 comments

Description (optional)

unable to compile wpf project with Polysharp. Compiling shows error originates from sourcegeneted files

Reproduction Steps

Create a new WPF project and include community MVVM toolkit version 7.1.2 and version of polysharp 1.14.1,

sample code thanking from msdocs

    string WaterState(int tempInFahrenheit) =>
        tempInFahrenheit switch
        {
            (> 32) and (< 212) => "liquid",
            < 32 => "solid",
            > 212 => "gas",
            32 => "solid/liquid transition",
            212 => "liquid / gas transition",
        };

Expected Behavior

project should compile with no issues

Actual Behavior

Severity Code Description Project File Line Suppression State Details
Error (active) CS0579 Duplicate 'global::System.AttributeUsage' attribute WpfAppExp C:\Users\XXX\Downloads\mvvm_wpf_nav_fullDI-main\mvvm_wpf_nav_fullDI-main\WpfAppExp\obj\Debug\net48\PolySharp.SourceGenerators\PolySharp.SourceGenerators.PolyfillsGenerator\System.Diagnostics.CodeAnalysis.NotNullAttribute.g.cs 14

Severity    Code    Description    Project    File    Line    Suppression State    Details
Error (active)    CS0101    The namespace 'System.Diagnostics.CodeAnalysis' already contains a definition for 'NotNullAttribute'    WpfAppExp    C:\Users\`XXX\Downloads\mvvm_wpf_nav_fullDI-main\mvvm_wpf_nav_fullDI-main\WpfAppExp\obj\Debug\net48\PolySharp.SourceGenerators\PolySharp.SourceGenerators.PolyfillsGenerator\System.Diagnostics.CodeAnalysis.NotNullAttribute.g.cs    21  
Severity	Code	Description	Project	File	Line	Suppression State	Details
Error (active)	CS0111	Type 'NotNullIfNotNullAttribute' already defines a member called 'NotNullIfNotNullAttribute' with the same parameter types	WpfAppExp	C:\Users\XXX\Downloads\mvvm_wpf_nav_fullDI-main\mvvm_wpf_nav_fullDI-main\WpfAppExp\obj\Debug\net48\PolySharp.SourceGenerators\PolySharp.SourceGenerators.PolyfillsGenerator\System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute.g.cs	25	

System info

This section should contain useful info such as:

  • PolySharp NuGet version 1.14.1
  • Windows 11 23H2
  • Visual Studio Community 2022 (64-bit) - Current
    Version 17.10.0

Additional context (optional)

ViewModel extends ObservableObject from the MVVM toolkit

updating the mvvmtoolkit to 8.2.2 fixed this issue