Exception when starting endpoint. Value cannot be null. Parameter name: endpoint

I’m using NServiceBus 6.4.3 with RabbitMQ transport 4.4.5

I’m getting this exception when trying to run my project:

  2020-05-18 11:00:59.0039 - FATAL: NServiceBus.Logging.NLog.Logger.Fatal - Exception when starting endpoint. System.ArgumentNullException: Value cannot be null.
    Parameter name: endpoint
       at NServiceBus.Receiving.<>c.<.ctor>b__0_1(SettingsHolder s) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Transports\Receiving.cs:line 17
       at NServiceBus.Features.Feature.ConfigureDefaults(SettingsHolder settings) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Features\Feature.cs:line 213
       at NServiceBus.Features.FeatureActivator.SetupFeatures(IConfigureComponents container, PipelineSettings pipelineSettings, RoutingComponent routing) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Features\FeatureActivator.cs:line 53
       at NServiceBus.InitializableEndpoint.<Initialize>d__1.MoveNext() in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\InitializableEndpoint.cs:line 60
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at NServiceBus.GenericHost.<Start>d__1.MoveNext() in C:\Build\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 48

I have no idea where to start investigating for this error.

Hi Liran,

It’s look like something is wrong with one of the Feature (custom extension). Start from doc - https://docs.particular.net/nservicebus/pipeline/features. Probably somewhere is missing value for ‘endpoint’ settings. The question is if it is settings required by the NSereviceBus or it is custom settings defined in one of the Feature?

Hope this. help.

NServiceBus 6.4.3 can be upgraded to 6.5.10, your RabbitMQ transport is already at the latest 4.x release.

Version 6.4.3 is no longer supported see https://docs.particular.net/nservicebus/upgrades/support-policy#supported-versions-nservicebus

Please upgrade to 6.5.10.

Based on the stack trace the error must fail somewhere here

I would like to see your EndpointConfiguration code. Is it possible to share your endpoint initialization code as well as the diagnostics file (if it exists).

I had this line mistakenly added: endpointConfiguration.DefineEndpointName(ConfigurationManager.AppSettings["EndpointName"]);
and I didn’t have the EndpointName key in my app.config

Thanks, that seems like a bug as we should verify that the passed value is not null.

To add to that, that is part of the NServiceBus.Host which is obsolete. I would recommend use an alternative hosting solution that is still supported in future versions:

We are validating the passed argument in the latest version of the host as part of NServiceBus 7: