Description
My understanding is that our CI servers now only run automated tests against release builds. If that's the case, this means that the many Debug.Asserts throughout the AspNetCore repo are pretty worthless since we can only ever see an assertion failures by running tests or samples locally even the Debug.Asserts in the test projects themselves.
I think the best solution is to run our automated tests against debug builds. I'm not asking for all our testing to be done against debug builds, but nightly tests of debug builds would probably be a good idea.
@davidfowl suggested using critical logs to replace Debug.Asserts. That was definitely the right approach for #11624, but in a lot of places we assert currently we don't have a logger. There's also the problem that not all our tests will fail given a critical log, but a lot will.
Changing Debug.Asserts to Trace.Asserts seems like a somewhat reasonable idea, but not only does that create performance concerns, it could also potentially introduce new DoS vectors as @benaadams rightfully pointed out.