Sdílet prostřednictvím


Debugging Windows Forms Applications that Use Application Settings with Visual Studio

Typically, you can debug a Windows Forms application that utilizes application settings the way you would debug any other Windows Forms application. For more information, see Creating a Windows Forms Application By Using the .NET Framework (C++).

The only difference involves user-scoped application settings. By default, when you debug a Windows Forms application in Visual Studio, it is launched in a process called VSHOST.exe, which creates a special environment in which the process will execute. Since this environment does not exactly match the environment in which the application runs outside of the debugger, you will notice that the application retains different user-scoped settings in these different contexts.

For example, say that your application has a user-scoped setting named UserFormColor, with a default value of Value1. You run your application under Visual Studio's debugger, and the application changes this value to Value2. If you next run the application on the Windows Desktop outside of the Visual Studio debugger, the setting will be Value1 and not Value2, because Visual Studio forced the creation of a separate file for the application's user-scoped settings.

If you feel you need one application settings file for these two different contexts, you can disable VSHOST.exe in Visual Studio.

See Also

Concepts

Application Settings Overview