martinothamar/Mediator

Bug after update to 3.0.0-preview.25 ?

KANekT opened this issue · 16 comments

after update from 3.0.0-preview.24 to 3.0.0-preview.25 for net6.0

I have error in rider and gitlab ci :
error CS1061: 'IServiceCollection' does not contain a definition for 'AddMediator' and no accessible extension method 'AddMediator' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)

Any other diagnostics reported? The source generator should emit something if it crashes

after update Mediator.g.cs is deleted

return in 3.0.0-preview.24 Mediator.g.cs generate again

    <PackageReference Include="Mediator.Abstractions" Version="3.0.0-preview.24" />
    <PackageReference Include="Mediator.SourceGenerator" Version="3.0.0-preview.24">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>

Not able to reproduce with the testapps I have here. I found some places where the error handling isn't great. I'm publishing another preview to rectify that. 3.0.0-preview.26 should be published in a couple of minutes

Are you sure you are not seeing any more error messages? Even if the source generator just crashes, there should be some logging to indicate that, something like this:
image

In the meantime I'll update a larger application and see if I can provoke any issues

BC89 commented

Same build error with both .25 and just now after pulling .26. VS just hangs.

Microsoft Visual Studio Professional 2022 (64-bit) - Preview
Version 17.10.0 Preview 2.0

    <PackageReference Include="AsyncFixer" Version="1.6.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" />
    <PackageReference Include="Mediator.Abstractions" Version="3.0.0-preview.26" />
    <PackageReference Include="Mediator.SourceGenerator" Version="3.0.0-preview.25">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="6.0.0-preview.4.21253.5" />
    <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
  </ItemGroup>

That's from a DIFF but you get the point. :)

Strange! Just to double check, you were referencing 3.0.0-preview.26 for both packages right? Because one of the references above is 25, and I wouldn't expect that kind of difference from the change I made..

I just tried to upgrade some more apps, no issues.. Must be something about the configuration. Could you tell me more about environment and Mediator configuration?

  • OS
  • .NET version (SDK and tfm)
  • AddMediator or the options attribute for configuration?
    • Which ServiceLifetime and have you configured a different namespace?

35>CSC: Error MSG0000 : MediatorGenerator got unknown error while generating mediator implementation, please report this to the issue tracker on github at https://github.com/martinothamar/Mediator/issues/new . Error: Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: 'System.Comparison1[System.Int32]'.: at System.Collections.Generic.ArraySortHelper1.Sort(Span1 keys, Comparison1 comparer)
35

Great, that should do it, thank you! Will report back when it's fixed

BC89 commented

<PackageReference Include="Mediator.SourceGenerator" Version="3.0.0-preview.25"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference>

Use 26 , not 25

I wasn't able to reproduce the exact error, but the comparer I had implemented was buggy for sure... #147

preview 27 should be out in a couple of minutes

BC89 commented

27 is fixed error

Great, thanks!

I can confirm that Preview 27 works great so far! Thank you!

Reporting back after a couple months that the notification publisher feature is still working great with no issues (v3.0.0-preview.27). I'm using TaskWhenAllPublisher to dispatch various Discord bot events in prod. At one point, I had a custom notification publisher and that also worked without any issues. 😁