reactiveui / Splat.DI.SourceGenerator

MIT License
30 stars 5 forks source link

[BUG] Failing to Build WPF Project #140

Closed drepamig closed 2 years ago

drepamig commented 2 years ago

Describe the bug This behavior happened on a more developed project, but I'm able to reproduce it on a new WPF project.

In a nutshell, I'm unable to build a project when Splat.DependencyInjection.SourceGenerator is included in the project. When I do, I get the following errors:

Severity    Code    Description Project File    Line    Suppression State   Priority
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'RegisterLazySingleton' with the same parameter types WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 28  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'Register' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 13  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'Register' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 21  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'RegisterLazySingleton' with the same parameter types WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 36  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'RegisterLazySingleton' with the same parameter types WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 44  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'RegisterLazySingleton' with the same parameter types WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 53  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'Register' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 60  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'Register' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 69  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'RegisterLazySingleton' with the same parameter types WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 76  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'RegisterLazySingleton' with the same parameter types WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 85  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'RegisterConstant' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 92  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'RegisterConstant' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 98  Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'SetupIOC' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 103 Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'SetupIOC' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 112 Active  Normal
Error   CS0111  Type 'SplatRegistrations' already defines a member called 'SetupIOCInternal' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 118 Active  Normal
Error   CS0756  A partial method may not have multiple defining declarations    WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 118 Active  Normal
Error   CS0579  Duplicate 'System.AttributeUsage' attribute WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 124 Active  Normal
Error   CS0101  The namespace 'Splat' already contains a definition for 'DependencyInjectionPropertyAttribute'  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 125 Active  Normal
Error   CS0111  Type 'DependencyInjectionPropertyAttribute' already defines a member called 'DependencyInjectionPropertyAttribute' with the same parameter types    WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 130 Active  Normal
Error   CS0579  Duplicate 'System.AttributeUsage' attribute WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 138 Active  Normal
Error   CS0101  The namespace 'Splat' already contains a definition for 'DependencyInjectionConstructorAttribute'   WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 139 Active  Normal
Error   CS0111  Type 'DependencyInjectionConstructorAttribute' already defines a member called 'DependencyInjectionConstructorAttribute' with the same parameter types  WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.g.cs 144 Active  Normal
Error   CS0757  A partial method may not have multiple implementing declarations    WpfApp1 C:\Source\repos\WpfApp1\WpfApp1\Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.Generator\Splat.DI.Reg.g.cs 7   Active  Normal

The curious thing is this used to work just fine on version 1.1.33 but now, when I revert, it still doesn't work. I've rolled back to an older commit on my main project that DID work, but it still won't build. This leads me to believe it's something with NET6. I'm on SDK 6.0.400. I would have likely been on 6.0.300 when I last had a successful build, but I have not yet tested that theory.

Steps To Reproduce

Failing Example Project: WpfApp1.zip

Provide the steps to reproduce the behavior:

  1. Create WPF C# App targeting NET 6
  2. Add ReactiveUI nuget packages:
    <ItemGroup>
        <PackageReference Include="ReactiveUI" Version="18.3.1" />
        <PackageReference Include="ReactiveUI.Events.WPF" Version="15.1.1" />
        <PackageReference Include="ReactiveUI.Fody" Version="18.3.1" />
        <PackageReference Include="ReactiveUI.WPF" Version="18.3.1" />
        <PackageReference Include="Splat.DependencyInjection.SourceGenerator" Version="1.1.69">
            <PrivateAssets>all</PrivateAssets>
        </PackageReference>
    </ItemGroup>
  3. Build
  4. See error

Expected behavior It should build.

Screenshots

Environment

Additional context

glennawatson commented 2 years ago

This is a known dotnet bug at the moment

There's some workarounds on here https://github.com/dotnet/wpf/issues/6792

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.