Rather, is there a way to tell if it’s been compiled with the optimization parameter enabled or disabled. I don’t want to know if it’s release or debug, since either can be enabled with or without optimizations. From my perspective, even though the code says it’s release version, is it truly optimized? Thanks.
Share
One way to check is to look at the
DebuggableAttribute(doc) on the assembly. TheDisableOptimizationsflag will not be set if the C# complier was passed the /optimize option.Note: Although this will work for the majority of scenarios this is not a 100% fool proof solution. It can be broken it at least the following ways
DebuggableAttributeit will take precedence over what the C# compiler defines