fix: resolve MediatR/Mediator request types from referenced assemblies - #121
fix: resolve MediatR/Mediator request types from referenced assemblies#121yatmund wants to merge 1 commit into
Conversation
|
Thanks for this. I want to make sure I understand the failure mode before merging, since I couldn't reproduce it. A few questions: On the module-name lookup: I checked what's actually inside these packages: Both On reproducing it: #122 (merged into Does that match the setup you were hitting the bug in, or was yours meaningfully different (multi-project solution, a specific package combination, etc.)? If you can point me to a minimal repro, I can turn it into a regression test. On On Once I know which of these is doing the actual work, happy to help get a regression test in and get this merged. |
|
Thanks for looking into this! So the MaxInheritors number was just pulled out of thin air really, the reason why things weren't quite working for me was that 50 was to low for the solutions I'm working on, I've reduced it 300. One of my solutions goes to 167 IRequestHandler implementations, wouldn't be surprised if some of our older ones goes beyond 300... I think your latest round of fixes, have helped with the module name look up stuff as well so I've dropped that. I also see you're looking at the Go To Handler stuff for .Send()? (yay!) |
…ating the handler search
4787a44 to
14d28cb
Compare
Well, I saw your PR, liked the idea but realized I was not comfortable not having any automated tests. So I added some yesterday and thought why not try add more tests related the feature you suggested :) |
Summary
Basically I just wanted to be able to use ALT + H / Go To handler directly from Mediator.Send() or the command within it and it wasn't quite working
Description
Go-to-handler did nothing on modern MediatR (12+) and Mediator setups. IsRequestTypeSupported looked up a PSI module named exactly "MediatR" or "Mediator" and resolved IBaseRequest/INotification from it, and Library.InitializeTypeElementsIfNeeded scoped the handler-interface lookup to that same single assembly. Since MediatR 10 those interfaces ship in MediatR.Contracts.dll, and Mediator's ship in Mediator.Abstractions.dll, so the types never resolved. IsRequest then returned false and FindHandlers returned nothing.
Resolve both the marker interfaces and the handler interfaces from the project module plus its references instead of a pinned assembly, and drop the now-unused moduleName plumbing.
Also: