Skip to content

Misleading error when hubName is null #2200

@ghost

Description

Describe the bug

If you are application is misconfigured, and a null hub name is provided then the following exception is thrown.

System.InvalidOperationException: 'A suitable constructor for type 'Microsoft.Azure.SignalR.Management.RestHealthCheckService' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.'

I found the error to be a misleading.

To Reproduce

Attempt to create a hub context where the hub name is null

 using var serviceManager = new ServiceManagerBuilder()

     .WithConfiguration(_configuration)
     //or .WithOptions(o=>o.ConnectionString = _configuration["Azure:SignalR:ConnectionString"]
     .WithLoggerFactory(_loggerFactory)
     .BuildServiceManager();
 var hubContext = await serviceManager.CreateHubContextAsync(null, cancellationToken);

Exceptions (if any)

System.InvalidOperationException: 'A suitable constructor for type 'Microsoft.Azure.SignalR.Management.RestHealthCheckService' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions