Form Height and Width changes with Visual Studio 2012

Symptoms

Developers debugging existing WinForms applications (targeting .NET 4.0 or older) or upgrading those applications to target .NET 4.5 (or newer) may notice changes in the Height and Width of some Forms.

Example of original behavior:
Running outside the Visual Studio debugger

Example of new behavior:
Running under the Visual Studio debugger

Cause

In order to take advantage of new Windows operating system features, a decision was made to change all Visual Studio processes to use Windows subsystem version 6.00. Also, new applications targeting .NET 4.5 (or newer) will target Windows subsystem version 6.00 (or greater) by default.

Resolution

Developers who are impacted by incorrect Form Height and Width when executing under the Visual Studio debugger may work around the issue by turning off the Visual Studio Debugger Hosting Process (vshost). This may be accomplished by doing one of the following:
  • Unchecking "Enable the Visual Studio hosting process" in their project's properties (Project Properties... Debug tab)
  • Setting the environment variable UseVSHostingProcess=false before starting Visual Studio

Developers who change their application to target .NET 4.5 (or newer) may need to either:
  • Change their source code to account for the differences in Form Height and Width.
  • Specify subsystem version 4.00 by adding <SubsystemVersion>4.00</SubsystemVersion> to their project file or by using the /subystemversion:4.00 compiler switch.


More Information

Disabling the Visual Studio hosting process may have a negative impact on the debugger startup performance.
Properties

Article ID: 2877623 - Last Review: Aug 21, 2013 - Revision: 1

Microsoft Visual Studio 2013 Preview, Microsoft Visual Studio Premium 2012, Microsoft Visual Studio Premium 2013 Preview, Microsoft Visual Studio Professional 2012, Microsoft Visual Studio Professional 2013 Preview

Feedback