Thsi is not a bug. This is a known issue. Please see the comment above the line that has the exception. It explains that this is the expected behavior. However, Microsoft plans to address this in a future release: https://github.com/dotnet/aspnetcore/pull/58573