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

Bug after update to 3.0.0-preview.25 ? #146

Closed
KANekT opened this issue Apr 8, 2024 · 16 comments
Closed

Bug after update to 3.0.0-preview.25 ? #146

KANekT opened this issue Apr 8, 2024 · 16 comments

Comments

@KANekT
Copy link

KANekT commented Apr 8, 2024

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

@KANekT KANekT changed the title But after update to 3.0.0-preview.25 ? Bug after update to 3.0.0-preview.25 ? Apr 8, 2024
@martinothamar
Copy link
Owner

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

@KANekT
Copy link
Author

KANekT commented Apr 8, 2024

after update Mediator.g.cs is deleted

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

@KANekT
Copy link
Author

KANekT commented Apr 8, 2024

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

@martinothamar
Copy link
Owner

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
Copy link

BC89 commented Apr 8, 2024

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. :)

@martinothamar
Copy link
Owner

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?

@KANekT
Copy link
Author

KANekT commented Apr 8, 2024

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

@martinothamar
Copy link
Owner

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

@BC89
Copy link

BC89 commented Apr 8, 2024 via email

@KANekT
Copy link
Author

KANekT commented Apr 8, 2024

<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

@martinothamar
Copy link
Owner

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
Copy link

BC89 commented Apr 8, 2024 via email

@KANekT
Copy link
Author

KANekT commented Apr 9, 2024

27 is fixed error

@martinothamar
Copy link
Owner

Great, thanks!

@austins
Copy link

austins commented Apr 11, 2024

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

@austins
Copy link

austins commented Jun 3, 2024

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. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants