Reputation: 5956
What's the best way to detect whether an app is running in debug mode in Managed C++/C++/CLI?
Upvotes: 1
Views: 478
Reputation: 25680
Or if it's built with debug? For regular C++ it's easy (_DEBUG is defined), for managed I don't know.
Upvotes: 5
Reputation: 2268
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)
Upvotes: 1