views:

1369

answers:

5

I attempted to open a C#/VB form in designer mode, and instead of the form, I got an ugly error message saying "The path is not of a legal form". This form used to work! What happened?


Thanks to all who have answered. This question is a problem I hit a while back, and I struggled with it for a long time, until I found the answer, which I posted below in order to help other people who might have hit this problem.
I can't accept my own answer as the solution, so please could you vote up my answer so that it appears first under the question? Thanks!

+2  A: 

I don't know what this error message means, but it seems to be associated with third-party controls on the form. Anyway, the solution is almost as absurd as the problem:

  1. Close the designer/error message.
  2. Open the form code.
  3. Right-click on the form code and select "View Designer".

Presto! The designer opens!

Shaul
A: 

Not enough information to correctly troubleshoot your problem. Please be more vague.

Excuse my sarcasm.

Sev
+3  A: 

Debugging design mode would help. From here:

  1. List item
  2. In visual studio, select the project you want to debug.
  3. Right click -> Properties.
  4. Select the debugging tab.
  5. Change the debug mode to Program.
  6. Set the “Start Application” to be your visual studio IDE (C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe)
  7. Set your solution file in the “command line argument field”.
  8. Apply -> OK
  9. Select the project you want to debug as the startup project.
  10. Run.
  11. Set a break point in the place you want to start debug (for example, your control constructor)
John
A: 

By path, it might be referring to a path to a file or folder. There could be a malformed path that you are trying to reference, i.e. forward slash instead of backslash. Also, what changed since the error came up? Did you move any files around? Did you save any previously unsaved code? Update from a version control system?

David Ackerman
A: 

This problem happened with me, and I found out it is because of bad reference. You have to review the assemblies that your application references.

Michel