0

I recently reset my whole laptop. After the reset, I installed all of my programmes, including Visual Studio 2013 (I had 2012 on my last build). I then dumped my projects into the projects folder of 2013 and...I COULDN'T RUN MY PROJECT!!! I can view the code and the designer but I can't run it.

The error is from Application.Designer.vb and it is a "System.InvalidOperationException" error. Under additional information, it says "An error occured creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object. Highlighted is Me.MainForm = Global.MyApplicationName.Form1

I have checked msdn for answers about System.InvalidOperationException but haven't found any fixes that work.

I really don't know what to do and don't want to lose my application as I've spent a fair bit of time on it.

Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
Josh-Mason
  • 319
  • 3
  • 8
  • 22
  • 1
    Very obscure, impossible to diagnose from just the exception message. Just restore the last working version of your project from source control. If you don't have any then you've just learned a very valuable lesson. – Hans Passant Oct 24 '13 at 17:30

1 Answers1

1

I have 2 suggestions to try

  1. Open Application.Designer.vb and just delete the word Global.

  2. Exclude (not delete) the mainform (Form1, apparently) from the project. Save it. Then include it again and go to Project Properties and make it the startup form again.

I've had similar issues (without the exception) when reorganizing pieces of large solutions into other namespaces. Often, I need to drill into the designers to change a ref to get it to run and it is usually removing 'Global' and/or adding the new Namespace ref. In your case, it sounds like a similar reference in the project did not get updated from 2012.

If that is the case, the second way should get VS to write back all the files in a manner that it likes.

Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
  • create a new simple project and save it. then look at the format of that `Me.MainForm` line in it app designer and see if you can mimic it in your project – Ňɏssa Pøngjǣrdenlarp Oct 24 '13 at 19:52
  • I think I'm just going t have to redo the whole project:( I have a back up of this project but it's the backup that gives the error in the question. Unless somebody pops up with a solution that works in time to come, I'm starting again... – Josh-Mason Oct 24 '13 at 20:00
  • create a new project and import/move the pieces of the old one into it. – Ňɏssa Pøngjǣrdenlarp Oct 24 '13 at 20:13