Reputation: 997
I just program a game in Windows Phone 8 with an advertising, but the advertisement only works when the Phone isn't in Debug mode. Is there a possibility to notice if the app is being debugged or not?
I tried it so, but it don't works.
bool b1 = false;
#if DEBUG
b1 = true;
#endif
if (!b1)
{
//no Debugging
}
Upvotes: 1
Views: 85
Reputation: 1798
The use of a preprocessor define will only tell you that you are running a debug version of the app. If you want to check that you are actively debugging, use this:
if (System.Diagnostics.Debugger.IsAttached)
{
//Debug stuff
}
Upvotes: 8