VS - vb file got corrupted - Unexpected token & Character is not valid - vb.net

After launching my project in VS2019, I suddenly got a Character is not valid error, and I was not able to run my project anymore.
I didn't change anything. I even did some undo's just to be save, but no luck.
The error remained, and it didn't point me anywhere.
I restarted VS and then it even got worse.
I couldn't see my code anymore. I just see question marks, and 6995 errors, all (unexpected token and character is not valid).
I tried several things, including deleting the .suo file, the settings file.
Restarting the pc and so on.
Sadly enough the "Previous Version" history of Win10 is switched off, so I can't go to a recent backup.
If I click on the designer he gives me the folling error message:
If I continue, I see my designer file in the end.
When I double click on a button, to try and see the code, he gives me new code in the designer file. Which is really strange.
Any idea on how to solve this?

Related

Values cannot be null. (Parameter 'baseName')

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
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.

Codewarrior 10.5 broken links from problems window to errors in code

Typically when I compile a project I am working on in Codewarrior, the Problems window displays the errors and warnings it finds. From there, I am able to click on the errors and I will be linked to the location of the error in the code. In the current project I am working on, the errors are displayed in the problems window, but they do not link to the error. It shows the correct file and path, but the hyperlink to the location in the code is broken. In the console window, I can use the Next/Previous error buttons to navigate to error, but I can't do this from the Problems window - which I find easier to read. I know that this error is limited to this project, because I have opened other projects since this started happening and do not experience this problem in those projects. When I started this project, I copied an existing Codewarrior 10.5 project that does not have this issue and began changing names and editing. I have a suspicion that I might have missed something during this conversion process, but I am running out of places to look.
I'm not sure the exact reason for this error, but I did correct it by deleting the folders in the workspace folder and re-importing the project.

Intellij isn't analysing my code

I have a scala project that I'm working on in Intellij. When I opened it up this morning, suddenly none of the code is being analysed properly. The main things I've noticed are that it says every variable is unused (even when it's used in the next line), it doesn't show an error if I try to use a variable that doesn't exist, and I don't get any errors if I try to use a class I haven't imported. TODOs also don't come up in blue.
Does anyone know if there is some sort of setting that somehow could have changed that would affect this? The problem only happens in this one project, all of my other projects are fine.
Edit: I have tried closing it and opening it again, invalidating the cache and restarting and restarting the entire computer.
Edit 2: I forgot to say, if I try to run a test it will come up with the correct compilation errors for things that shouldn't work, but it still doesn't show the error in the code itself.
I'm still not sure why it happened, but I fixed it. I deleted the .idea folder and re-imported the project, and everything was analysed properly.

Visual Studio cannot start debugging

I'm working through a project in Visual Studio 2013 and I got the following error: "Visual Studio cannot start debugging because the debug target is missing". I've tried changing the build output path under Project -> Properties but it still doesn't work. So what gives?
Check your code and make sure you aren't missing a curly bracket anywhere. If one was accidentally deleted, moved, or misplaced, it causes this error among MANY others depending how critical the placement of the curly bracket is in your project.
^
I just recently had this problem in a project I was working on. I had highlighted to delete a section of code, and it took out a curly bracket with it. Unnoticed by myself, it took me a few days to finally realize that's what happened.
You won't get an error from the bracket missing, so it's stupid in itself and impossible to find at times.. but I had 51 errors, 7 warnings, and that "can't start debugging because the debug target is missing" error when I attempted to run the program, after the curly bracket went missing.
It's not to say that you might not have another issue going on that is causing this, but the curly brackets can wreak havoc if they aren't precisely placed. So it's worth checking into that before getting too extreme in options to "fix" the start error.
For future reference if this problem occurs again. Good luck.
Possible VS 2019 Solution
Right Click on Solution Properties
Go under Common Properties> Startup Project
Set Single startup project
Right Click on Project Properties
Click Application
Set Application Type to Windows Forms Application or Console Application or Windows Service
Click Startup Object
Set to Anything Other than (None)
Left Click on Project Properties
Set Copy Build Output to Output to True
Then Run
Hopefully that works for you

VBA won't compile? "Error Accessing the system Registry"

I was working on a Form and then Access crashed. When I tried to open it, I was prompted with an error which I didn't recognize how to fix right away. Something like
Form1 doesn't exist , if the invalid form name is in a macro ...
At the time, I couldn't figure it out, so I hit "Compact and Repair", closed and re-opened access a few times. Then there was another message, don't exactly remember but soemhting like "To continue, all VBA code must be deleted." I said Ok, because I have a few back up copies. But that didn't fix anything.
Then I figured out how to fix the original error. "Form1" was my default form to open on startup, so I changed it. So everything works, I copy the code back in, but obviously the code doesn't work. The error message is:
Compile Error user defined type
on the DAO.QueryDef
Then I follow MS Help and check the references, and when I click on Tools -> References, I get
Error acessing the System Registry.
So, any thoughts that include not messsing with the Registry?
Ok, so the real problem was the
Compile Error: User-Defined Type Not Defined
iDevelop was right, the file was corrupted. I had to make a new access file (they were .accdb not .mbd , but some concept), and import all objects without the code.
To make sure wasn't corrupted, I copy pasted it into Notepad first, and then into the new file. (Just as an extra precaution). And then it worked.
I am still getting the error:
Error accessing the System Registry.
when I go into Tools-> references,
but, I think it is probably related to my permissions, so maybe it is intended.