views:

336

answers:

2

Hi,

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

A: 

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
A: 

I placed serveral 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 missunderstand 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, ...

Martin Moser
Have you actually tried the code I posted?
Hans Passant
yes I tried it, but it doesn't do anything...
Martin Moser