As part of a migration to another cloud provider, we have found the need to be able to debug our .NET 2.1 application in a Kubernetes pod (running on mcr.microsoft.com/dotnet/core/aspnet:2.1) which I have been assigned to look into.
Our CI engine currently builds with "-c Release" but I've noticed the following wording on https://devblogs.microsoft.com/devops/debugging-net-core-on-unix-over-ssh/ :
For debugging, there are two important notes. First, it is much harder to debug retail-compiled code than debug-compiled code, so it is highly recommended to use the ‘Debug’ configuration. If you do need to use the ‘Release’ configuration, make sure to disable Tool->Options->Debugging->Just My Code.
I have done Java for longer than I care to think about (where most of the optimization happens inside the JVM at runtime), but I am unfamiliar with .NET, so I was wondering exactly why the release compiled code is harder to debug.
Is it simply because the compiler do the usual tricks like unrolling loops, evaluating string expressions and so on, or are there much deeper transformations happening under the covers? (Things like I've read that the Intel C++ compiler can interchange two loops if it means that the array traversal being done with them happens in a more cache efficient matter)