I caused this issue by adding the [DebuggerNonUserCode] attribute to the app.Use method in Program.cs.
app.Use([DebuggerNonUserCode]async (context, next) =>