Values cannot be null. (Parameter 'baseName')

Viewed 179

When trying to open the form deisgn it says values cannot be null. (Parameter 'baseName'). I still can run the system without error. Dont know how to fix it and have to change some gui design. Help me its for my school tnx

3 Answers

I had this problem this morning and a few hours later I decided to just start over and copy the code from the old project to the new empty project. Everything is working in the new copy of the project. I copied from old to new by drag-n-drop. I copied all the UserControls before I copied anything that uses them, and built, then copied over the remaining things, and went through all the errors caused by the change in name of the top-level Namespace.

(All of the Namespace errors were in the .Designer.vb files. I have posted elsewhere "never edit those files by hand unless you know what you are doing." This case was one of the rare exceptions.)

I had the OP's problem that when I tried to open a Form in the designer, I got the message

Value cannot be null. (Parameter 'baseName')

It didn't matter if I tried to open the Form in Solution Explorer or by pressing Shift-F7 in the Form's code window. However, sometimes Shift-F7 resulted in a wait cursor followed by silence - no error message.

Like the OP, the project did run without errors (well, same bugs as before but you know what I mean).

Another symptom: If I launched VS and tried to open the Form designer before Intellisense was initialized, instead of the other error, the window that should show the layout of the Form showed this instead:

File path: full path of the file I was trying to open Frame GUID: 2c01570-c72c-11d0-88c3-00ac0c9110049 Frame mode: VSFM_MdiChild Error code: 0x80131500

There are no MDI containers in my project. It's a reference to VS 2019.

  • The same error occurred in every Form and UserControl in the project.
  • The same error occurred in any new Form or UserControl that I added to the project.
  • The error did NOT OCCUR in any and all other projects built in VS 2019 with a target of .Net 5.0
  • The error DID OCCUR with the same project on another machine running a clean install of a later version of VS 2019.
  • Attempts to Clean Solution or Clean Project failed, with a generic error message, it was something like "Clean Project failed."
  • Nothing about these problems appeared in any event logs.
  • Every time the problem happened, when I shut VS, one process was left running (per TM).

Here are some other things I did to try to suss it:

  • Ran a repair install on VS 2019 and reboot.
  • Opened each and every VS-generated file in another project and compared them line-for-line (most are text) against the corresponding files in the broken project. No data-independent differences.
  • Searched exhaustively with 3 search engines and many terms for someone else that posted about this error. This is the only post I found.
  • Deleted, renamed, or moved files that are automatically generated by VS, including some Json files, XMLs, and caches.

What I did not try:

  • Roll back the code to the most recent commit.
  • Uninstall VS 2019 completely, reboot, install VS 2019 as if an initial installation.

Just had the same experience. I took me a while before I got everything to work again, but the clue in my case was that I had added a new item to my project, and for some reason I had managed to delete the file name in the process so the only thing left was 3 new files with only the extensions .resx, .cs and .Designer.cs I quickly deleted the ".cs" file but forgot the rest. Suddenly I was unable to open my main form in the designer - and the “Value cannot be null. (Parameter 'baseName')” started to appear. It was only affecting my main form. I tried almost everything described above except the reinstalling part. But then I deleted ".Designer.cs" and ".resx" from within visual studio (Solution Explorer), and then the problem went away.

I started getting this error after using a hack to support generics forms (e.g. MyForm). The designer generated a file:

MyForm.resx

which worked for design time (even with the form being generic) but crashed at runtime. My hack was to rename the .resx file:

MyForm`1.resx

However that is when the Designer stopped working. It stopped working for ALL forms/user controls in entire solution (not just the generic I was experimenting with). I assume there is some kind of process that crawls all the resx files whenever you open any Designer and that is the source of the Exception.

I was able to work around the issue by:

  • Renaming the resx back to its non generic title (i.e. MyForm.resx)
  • Restarting visual studio.
Related