I have a Windows Form application that I’m working on and I have some settings that a user is prompted for the first time that they use the application. (The settings that are created by looking at the project properties).
What I’m trying to do for testing purposes is have those show up everytime that I enter debug mode, but at the moment it is actually saving them for me so I only see it the one time.
I’m using Microsoft Visual C# 2010 Express.
I assume you have the dialog already, but don’t know how to find out if you are in debug mode.
One way is to use the preprocessor
This way the application compiles different depending on the solution configuration combo in Visual Studio. If you take the debug build and starts it from outside visual studio you will still run the DEBUG part.
The other possibility is to check if you have a debugger attached.
This way the behavior changes if you start from Visual Studio or not. You can start the release build from Visual Studio (or attach a debugger after you have started the application) and still come to the debug-part.
Most likely the second alternative is what you want, but if you want to be able to send a test-binary to your customer with the debug behavior the first alternative is the way to go.