martinothamar / Mediator

A high performance implementation of Mediator pattern in .NET using source generators.
MIT License
2.16k stars 71 forks source link

Sample projects don't work in isolation #133

Closed matthewblott closed 11 months ago

matthewblott commented 11 months ago

I thought this might be related to #94 but it seems the sample projects don't work by themselves. For example the ASPNET_Core_Indirect project runs fine when I build the Mediator solution but if I separate the three ASPNET_Core_Indirect projects then the handlers aren't registered. Here's a screenshot of my setup, I haven't made any changes at all:

Screenshot 2023-12-09 at 22 23 42

Here's the output when running a curl request in the terminal:

Screenshot 2023-12-09 at 22 31 04

It's because the handlers haven't been generated. This is what I would expect to see in the GetWeatherForecastHandler class and is what I get when I run the samples as part of the Mediator solution:

Screenshot 2023-12-09 at 22 33 34

But this is what I see instead (no references appear):

Screenshot 2023-12-09 at 22 35 59

Any help appreciated :-)

matthewblott commented 11 months ago

I'm going to close this. I'm trying out the version 3.0 preview release and it appears I can get it to work. I'll post back with an update but I don't want to keep a ticket open if it isn't worth fixing :-)

martinothamar commented 11 months ago

This is kind of unexpected for me... I will look into this and the linked issue. There's nothing in the main branch that should affect this

matthewblott commented 11 months ago

I have an example of a multi project solution with version 3.0 and .NET 8 here. I have it working for my purposes now. Thanks all the same :-)