Closed Richiban closed 5 years ago
The method you describes avoids the "outer" scanning, ie when the host scans to find your "IConfigureThisEndpoint
". The scanning to find handlers etc still takes place in the separate appdomain that is created to run the actual endpoint. You need to use the scanner settings to configure exclusions:
https://docs.particular.net/nservicebus/hosting/assembly-scanning?version=core_5
Does that make any sense?
I will see if I can update the doco to make this more clear.
Hi @andreasohlund, I'm pretty sure it's the "outer" scanning that's throwing the exception.
My IConfigureThisEndpoint is not even being run.
To prove this to myself, I have replaced the entire thing with:
public class EndpointConfiguration : IConfigureThisEndpoint
{
public void Customize(BusConfiguration config)
{
throw new Exception("Bang");
}
}
in addition to putting in a breakpoint, Sure enough, it's not being run.
If it's not even being run, then I can't configure assembly scanning?
Ok I see it now, you're correct since the outer scanning doesn't happen we're doing a fresh scan immediately
The only workaround I see is to actually fix the scanning error with some asm redirect in your app.config or to pass the assemblies that you want scanned on the cmd-line like described in
@Particular/nservicebus-maintainers @Particular/host-maintainers thoughts on this one?
Our docs seems to be incorrectly stating that:
Alternatively, it's possible to control which assemblies should be scanned. That can be done in code by implementing IConfigureThisEndpoint interface:
That isn't true since we will blow up before reaching user code?
Thanks; while passing assemblies on the command line does work (I've just tried it) it's fine for dev; it's not going to be a good solution for us for production--it's going to be a real ****ache to fit it into our deployment process.
I shall try fixing the scanning error first. I'm not very confident however, since there assemblies that are "not found" that I'm not even referencing and are not present in the bin folder. What's looking for them?
Any chance you could create a small repro solution that we can look at to help you get the scanning issue sorted?
@Richiban any progress on this, perhaps we can get on a webcall and look at the problem if you prefer that?
@andreasohlund Hi Andreas, thanks so much for the offer! Unfortunately I've had to put this down for the moment as something more urgent has come up (as it always seems to do!), so as soon as I pick it up again I might take you up on that offer.
As an aside we're deprecating the Host (as of core v8) and recommend our users to move to self hosting instead so that might be an option as well
https://docs.particular.net/nservicebus/upgrades/host-7to8#migrating-procedure
I'm closing this as there hasn't been any updates for more than a year. If this issue is still a problem, please get in touch with our support at https://particular.net/support.
I have an endpoint that I am trying to "upgrade" to Core 5.2.19, Host 6.0.0. For legacy reasons, we can't go any higher than 5.2.19.
When running my endpoint I get assembly scanning exceptions:
I have manually configured the assemblies to scan in my
Customize(BusConfiguration)
method, but this exception is being thrown before my endpoint configuration is even being run.Reading the docs at https://docs.particular.net/nservicebus/hosting/nservicebus-host/?version=host_6#endpoint-configuration it explicitly states that "The scanning process can be avoided if the class containing endpoint's configuration is explicitly stated".
I have the following
nservicebus.host.exe.config
:but the error still occurs.
This seems like a bug. Has it been fixed in NSB v5?