rebus-org / Rebus

:bus: Simple and lean service bus implementation for .NET
https://mookid.dk/category/rebus
Other
2.26k stars 354 forks source link

Native AOT with .NET 8 #1095

Open SbiCA opened 1 year ago

SbiCA commented 1 year ago

Hi @mookid8000

Did you already try out using rebus with native AOT in .NET 8?

Do you already have an idea what's going to break? I guess the Router and Handler discovery might be affected?

Cheers

For people interested in it see https://youtu.be/km9CnGYBafI

mookid8000 commented 1 year ago

I haven't tried it yet 🙂 but if I understand things correctly, it's not reflection as such that causes things to break, it's more when reflection is used to load types that the AOT analyzer cannot predict are going to be loaded... and I can't recall any situations where Rebus does that.

E.g. I would assume that the AOT system will know that your handler is needed, because you did something like this:

services.AddRebusHandler<YourMessageHandler>();

so that type and its dependencies should be kept. But I might be wrong 😅 it would be fun to try though.

dguisinger commented 1 week ago

@SbiCA Did you ever have a chance to try out Rebus with AOT? Was there a determination of whether or not it works?

SbiCA commented 6 days ago

@dguisinger nope I'm afraid not so if you made first experience I'd also be interested 😅

dguisinger commented 6 days ago

@SbiCA hah, I've recently ripped out AutoMapper and MediatR because they didn't work with AoT and the project owner doesn't want to put time into making it work. I then spent time looking into Mass Transit and then realized it also doesn't work with AoT and their project owner has a similar attitude. I've pretty much given up on non-Microsoft frameworks at this point and don't want to waste more time evaluating things just to find they don't work with modern framework runtime options. Kind of disappointed MSFT just said they are holding back their event framework due to complaints... I bet it would have worked just fine out of the box.