Are there attributes that affect how the CLR optimizes during a JIT compile?
.net, attributes, clr, optimization
Solution
Only one I've used in debugging something:
[MethodImpl(MethodImplOptions.NoInlining)]
This prevents JIT from inlining a method. There's also a:
[MethodImpl(MethodImplOptions.NoOptimization)]
Which just prevents JIT from optimizing anything, in case you found a rare bug in code generation that's actually causing the issue.
Problem
As the question says, I am curious if any of you know about attributes that affect how the CLR will compile/optimize the bytecode. Is there an attribute that will affect code inlining decisions? Unroll loops? Are there undocumented attributes on classes generated for anonymous types/delegates? There's probably attributes to disable optimizations for debug purposes, but somehow I am not so interested in those.