OK, so like 20 years ago (yes, I’m exaggerating a little) it was quite common to run across compiler bugs, where you needed to disable some optimization locally or globally to get your program to work correctly. I think that’s mostly gone now, but there are still the occasional cases. Now days the most common reason for turning off optimizations is because you actually want to debug your code.
Am I right? The CLR has one neat little custom attribute that allows you to turn off just one optimization in the JIT at a very local level: MethodImplAttributes.NoInlining
My question is this: Why would you ever want to use this? My best guess is that people are wanting to the the StackTrace class to somehow compensate for C#’s lack of an equivalent for the __FILE__ macro (or it’s friends __LINE__, __FUNC__, etc.)
What do you use this? Or do you not use it?