Syndication

How to determine if a .NET Assembly was compiled in Debug Mode

A colleague asked this question in an email and as often happens I didn't know the answer. However Mark Rees did, and as I couldn't find the answer on the web just thought I would post it here as I thought it was rather a gem:

The best way to do this is to load the assembly in code and grab the System.Diagnostics.DebbugableAttribute attribute from the assembly custom attributes collection and check to see if the "IsJITTrackingEnabled" property is true.

  • If it is true then the assembly was compiled in debug mode; if it's false then it wasn't.
  • If the attribute is not present then the assembly was also not compiled in debug mode.

Now I know. Thanks Mark!

Published Wednesday, April 05, 2006 10:09 PM by adamhems

Comments

# re: How to determine if a .NET Assembly was compiled in Debug Mode @ Wednesday, April 05, 2006 6:18 PM

Without code, I would think that you could pop open ILDASM and look at what DebuggerAttribute flags are set.

Tobin Titus

Anonymous comments are disabled
 
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement  
Page view tracker