What's the best way to detect whether an app is running in debug mode in Managed C++/C++/CLI?
+4
A:
IsDebuggerPresent()?
Or if it's built with debug? For regular C++ it's easy (_DEBUG is defined), for managed I don't know.
Marcus Lindblom
2009-03-04 19:00:49
+1
A:
array<Object^>^ debuggableAttributes = Assembly::GetExecutingAssembly()->GetCustomAttributes(DebuggableAttribute::typeid, false);
Console::WriteLine(debuggableAttributes->Length > 0);
(The compiler adds a DebuggableAttribute to an assembly when compiled in debug mode)
Jim Arnold
2009-03-04 20:24:08