Have a look this one, I just wrote:
Accurate way to tell if an assembly is compiled in debug or release mode in c#[
^]
public static bool IsInDebugMode(string FileName)
{
var assembly = System.Reflection.Assembly.LoadFile(FileName);
var attributes = assembly.GetCustomAttributes(typeof(System.Diagnostics.DebuggableAttribute), false);
if (attributes.Length > 0)
{
var debuggable = attributes[0] as System.Diagnostics.DebuggableAttribute;
if (debuggable != null)
return (debuggable.DebuggingFlags & System.Diagnostics.DebuggableAttribute.DebuggingModes.Default) == System.Diagnostics.DebuggableAttribute.DebuggingModes.Default;
else
return false;
}
else
return false;
}
I was born in the south of China, started to write GWBASIC code since 1993 when I was 13 years old, with professional .net(c#) and vb, founder of www.xnlab.com
Now I am living in Sydney, Australia.