views:

170

answers:

2

We've recently upgraded from VS2008 to VS2010. The conversion of our vb.net Windows Forms app went well, but we're now having big problems with the forms designer.

Pretty much any change to the layout of a form (sometimes just a solution rebuild) will work once, but on recompile, the IDE designer refuses to display the form, the error message being a null-reference exception (with no details as to what).

Closing and restarting VS2010 will cure it, but only for one compile cycle - and it's obviously not practical to close and reopen every time. Closing and reopening the form does not fix it.

We had these very occasionally before, if there was something wrong in the form's load event, or more rarely for random reasons, but since VS2008 SP1 this was never serious.

Whereas now with VS2010, it's now every form, every compile.

It's completely unworkable, and we've had to revert to VS2008 for winforms dev.

Any suggestions would be greatly appreciated..

+3  A: 

You can debug design mode:

  • In project properties, in the debugger tab, set the name of the executable to devenv.exe.
  • Run/debug the project: this launches a 2nd copy of Visual Studio
  • Use the 2nd (being debugged) copy Visual Studio to open the form in design mode

You may find more detailed information on the 'net, by Googling for 'debug design mode'.

ChrisW
Well my problem has gone away, but I'm not sure why... I proceeded as you suggested, and I opened the form in design mode, expecting it to break - but it didn't. I tried a couple of the forms that had been breaking before - nothing untoward. So I shut everything down, and opened up the solution again in an ordinary single IDE. Presto - no more problems. So I seem to be sorted (famous last words!!) but I don't really know why. Thanks for your suggestion, anyway.
ChrisA
+1  A: 

Is your project Targets to .Net Framework 4 Client Profile or .Net Framework 4 ?

If you are not intentionally targeting to .Net Framework 4 Client Profile then change it to .Net Framework 4 you have a fair enough chance.

If, that was not helpful. Please do the above procedure as ChrisW said. That is the last option.

Avatar
Thanks for this.. sadly Framework 4 isn't yet an option for us, since we'd need to get all our customers to upgrade their computers as well. Many of the users don't have installation rights, so it's not an insignificant exercise, writing to all the IT departments, asking them to upgrade the clients, waiting till they're all upgraded, etc etc.
ChrisA