Ensure that your exception handling is set. something simple like this:
app.UseExceptionHandler(exceptionHandlerApp => exceptionHandlerApp.Run(async context => await Results.Problem() .ExecuteAsync(context)));