It seemed like a simple task – build a user control to search a database by date, so yesterday afternoon I set about putting the form together, using the Developer Express .NET controls. The form all seemed to be working fine, until I tried to reopen it in Visual Studio to tweak the layout slightly, at which point Visual Studio presented me with this totally useless error message – “The designer loader did not provide a root component but has not indicated why.”
Bizarrely the control still worked absolutely fine when I run the application – no problems at all. The problem is that Visual Studio runs part of the control to allow it to load up in the editor, and that is apparently what is failing – however finding out exactly what is failing is a bit of a problem.
In the end I spent a couple of hours messing around trying to find out what was failing. The online sources of help, even the Microsoft sites tended to take the attitude that ‘It does do that from time to time doesn’t it…’ and then pretty limited suggestions on how to solve it ranging from manually working through the automatically generated code that the editor is using to try and display the control commenting bits out, or deleting the bin and obj folders. I tried both, and neither worked. About the only progress I could make was to get it to produce a dialog box instead with an “Exception of type System.ComponentModel.Design.ExceptionCollection was thrown” error instead.
This morning I came in and decided that the quickest way to solve the problem would be to rebuild the control, so I set about putting it together again, all appeared fine, and then five minutes ago, I got the same useless error message again.
Whilst it is questionable according to some to have a visual editor that is dependant on working code to display, that is what we are stuck with in Visual Studio – however in what is the third major version of the product, you’d think that Microsoft could actually get it to work, or at least give some sort of clue as to where the form is going wrong! Certainly at the moment it is a far cry from the image portrayed in the Microsoft adverts – hardly more productive…
Update: I’ve made some progress with finding the source of the problem. I moved the problem control into a totally clean solution, the idea being that this can be distributed amongst the other developers on the team, to see if the problem occurs consistently. Interestingly, it produced a new error message, “The variable ‘Controls’ is either undeclared or was never assigned” a few times before reverting to the previous error messages that had been occurring with the other project. I then tried it on an alternative PC, on which it worked.
That now leads on to trying to establish what the difference between the two installations of Visual Studio and the machines actually are. The machines are architecturally different, one being a relatively new dual-core box, and the other a good deal older single core machine. However both are running the same version of Windows XP, and the main version number on each Visual Studio install appears identical. However looking at the version numbers of the installed Visual Studio components on each machine does appear to show up some differences in the core components. So moving on, the next thing to try is to rerun the latest Visual Studio Service Pack install…
Update 2: So the Visual Studio Service Pack install didn’t work. Ultimately it was a case of totally uninstalling Visual Studio and clean installing the whole thing from scratch. On paper the new installation is no different from what was on there before – the difference is that my project is not producing the error message any more, so something is different – quite what I guess I’ll never know!