Skip to content

Kestrel Configuration Reload Certificate ArgumentNullException #64307

@mhartmair-cubido

Description

@mhartmair-cubido

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When having appsettings reload enabled and changing the Kestrel HTTPS certificate while the app is running an exception is thrown.

Expected Behavior

No exception is thrown.

Steps To Reproduce

Program.cs

WebApplication.CreateBuilder(args);
// this is enabled by default:
builder.Configuration.AddJsonFile("appsettings.json", true, reloadOnChange: true);

Change appsettings.json Kestrel.Certificates to another one while having the aplication running

"Kestrel": {
  "Certificates": {
    "Default": {
      "Subject": "www.contoso.com", //change to another one
      "Store": "My",
      "Location": "LocalMachine"
    }
  }
}

Exceptions (if any)

"Unable to reload configuration."
System.ArgumentNullException: Value cannot be null. (Parameter 'path2')
at System.ArgumentNullException.Throw(String paramName)
at System.IO.Path.Combine(String path1, String path2)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.CertificatePathWatcher.RemoveWatchUnsynchronized(CertificateConfig certificateConfig)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.CertificatePathWatcher.UpdateWatches(List1 certificateConfigsToRemove, List1 certificateConfigsToAdd)
at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Reload()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.RebindAsync()

.NET Version

10.0.100-rc.2.25502.107

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-kestrel

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions