Claire,
While most of these suggestions are acceptable, I think that you should
use reflection to determine whether or not the assembly has the Debuggable
attribute attached to it. Most compilers (should) attach this to any
assembly compiled in debug mode. The C# compiler definitely does, and I
think it would be safe to say that the other .NET compilers issued by MS do
as well.
In order to determine whether or not the assembly was compiled in debug
mode, get the Debuggable attribute from the assembly.
Assuming that you have an Assembly instance, this is how you would do
it:
// The assembly is in a variable named assembly.
object[] attributes =
assembly.GetCustomAttributes(typeof(DebuggableAttribute), true);
// If the array is null, or has length of zero, then it is not debuggable.
if (!(attributes == null || attributes.length == 0))
{
// It is debuggable, figure out the level.
DebuggableAttribute debug = (DebuggableAttribute) attributes[0];
// At this point, you can access the DebuggingFlags property to
determine the level of debugging.
}
Hope this helps.