genaray / Arch.Extended

Extensions for Arch with some useful features like Systems, Source Generator and Utils.
Apache License 2.0
142 stars 35 forks source link

Warning: EventBus conflicts with imported type EventBus #65

Open vorban opened 4 months ago

vorban commented 4 months ago

I have a fresh Monogame project with Arch and all Arch.Extended plugins:

<ItemGroup>
    <PackageReference Include="Arch" Version="1.2.7" />
    <PackageReference Include="Arch.AOT.SourceGenerator" Version="1.0.0" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
    <PackageReference Include="Arch.EventBus" Version="1.0.2" />
    <PackageReference Include="Arch.LowLevel" Version="1.1.0" />
    <PackageReference Include="Arch.Persistence" Version="1.0.3" />
    <PackageReference Include="Arch.Relationships" Version="1.0.1" />
    <PackageReference Include="Arch.System" Version="1.0.2" />
    <PackageReference Include="Arch.System.SourceGenerator" Version="1.1.2" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
    <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
    <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
  </ItemGroup>

I try to dispatch an event exactly like in the sample project:

var @event = (Main.World, key);
EventBus.Send(ref @event);

I get a warning on compilation:

warning CS0436: The type 'EventBus' in 'Arch.EventBus\Arch.Bus.QueryGenerator\EventBus.g.cs' conflicts with the imported type 'EventBus' in 'Arch.EventBus, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'Arch.EventBus\Arch.Bus.QueryGenerator\EventBus.g.cs'.

It compiles and works fine but I like it when there is no warning. I've tinkered with the .csproj without success.

Did I fail to configure something ?

genaray commented 4 months ago

Hey, thanks for the issue!

I actually have no idea where the warning comes from, I'm gonna check that out!

metaphist commented 2 months ago

I had a different issue where EventBus.Send wasn't being detected at all. After changing to Arch.Bus.EventBus.Send I start to get the same warning described here, but code was now working. My packages are all newer than the OP, but all the Arch packages are there

<ItemGroup>
    <PackageReference Include="Arch" Version="1.2.8" />
    <PackageReference Include="Arch.AOT.SourceGenerator" Version="1.0.1" />
    <PackageReference Include="Arch.EventBus" Version="1.0.2" />
    <PackageReference Include="Arch.LowLevel" Version="1.1.0" />
    <PackageReference Include="Arch.Persistence" Version="1.0.4" />
    <PackageReference Include="Arch.Relationships" Version="1.0.1" />
    <PackageReference Include="Arch.System" Version="1.0.5" />
    <PackageReference Include="Arch.System.SourceGenerator" Version="1.1.4" />
    <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
    <PackageReference Include="NUnit" Version="4.1.0" />
    <PackageReference Include="Utf8Json" Version="1.3.7" />
  </ItemGroup>