0

I just tested which type of code is executed by the WinForms Designer in VS 2008. It seems that the designer is not executing the default constructor anymore. I added a simple thing like this.Text = "foo"; nothing is changed in the designer.

Did I miss a change between VS 2005/2008? (or SP1)

tia

Fabian Steeg
  • 44,988
  • 7
  • 85
  • 112
Martin Moser
  • 6,219
  • 1
  • 27
  • 41

2 Answers2

0

Did you set a breakpoint to see it skip?

If its the first form in the project, instead of starting with "Run", you can F10 (Step Over) to start at the first line of code. From there you can trace the execution.

.NET 2.0 and above use Partial Classes for windows and web forms. Is it possible that the constructor that is being hit is not default.

StingyJack
  • 19,041
  • 10
  • 63
  • 122
0

I placed several statements (setting the background, MessageBox.Show, File.WriteAllText,...) into the constructor including System.Diagnostics.Debugger.Break(), but nothing causes any type of response...

Not to misunderstand me, it is the behavior I'd like to have, but I know I had problems in VS 2005 regarding this issue, and I don't find any info about the fact that there is a change in the Winforms Designer.

Using the .NET reflector I don't see any additional constructors, but maybe the designer is creating one on-demand, ...

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Martin Moser
  • 6,219
  • 1
  • 27
  • 41