VB.NET Call Stack in Microsoft Visual Studio - Wrong Line of Source Highlighted? - vb.net

I seem to be having an issue using the call stack viewing functionality of Microsoft Visual Studio 2010 Professional.
During debugging, my application crashed, so I inspected it with the call stack view.
The offending line was contained within called showInDGV(...) nothing exciting, just trying to read an uninitialized variable or something...
All well and good, so next thing I did was check to see where the call to showInDGV() was coming from, because it is called from multiple places.
When double clicking the entry in the call stack (the entry that should highlight a showInDGV(...) subroutine call), the IDE highlighted the incorrect line.
Instead of highlighting showInDGV(), it highlighted the next non-empty line below it, which was End Sub
Clearly something is wrong here....
So I inspected the call stack further - turns out Visual Studio is highlithing the wrong line whenever I try to debug using the call stack.
This isn't actually the first time this has happened. In fact, it seems to always happen when working on a large project.
Initially, the call stack works properly and highlights the correct line, but at some point it gets messed up, and then it never seems to fix itself, even after closing and re-opening the program.
Does anyone know the cause/solution to this issue? I figure it might be some sort of corruption in the visual studio project, and I considered copying and pasting the source code into a new project but even if that fixed it, it wouldn't prevent it from happening again.

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.

Visual Studio breaking without a breakpoint in a VB project?

Running a particular project in Debug, Visual Studio is always stopping at the Public Sub New() line in my main form (it's an older project, so the code is within a autogenerated region in the .vb file rather than a .designer.vb file). No idea why this is happening and it's becoming a headache. It doesn't happen in any of my other VB projects (or running under Release). I can just hit F5 and it continues as normal.
Things I have tried:
Debug > Delete all breakpoints
Deleting the .suo file
I should note that both before and after doing the above, there is no breakpoint symbol next to the line. The execution just pauses and the line gets highlighted with a yellow arrow, as with a normal breakpoint line.
Why would VS be breaking at this opening line even without any breakpoints? I'm pretty sure I deleted the relevant files, so I would guess there's a VS setting I can't seem to find (but if it's a setting, wouldn't it affect other projects as well?).
Also, there are multiple developers working on this project. I am the only one this happens to.
The issue was that "Enable Just My Code" was turned off in my debug settings.
I'm still not entirely sure why that caused it to break at this particular line without a breakpoint attached (other projects don't break here, even my fellow developer didn't have this issue after matching his settings with mine and debugging the same project...), but after checking this option, it no longer breaks at that first line.

VB.net Missing Data

I didn't really know how to title this error but yeah, I used the quick replace function in vb and replaced "comp" instead of "comp." now I have a massive error, my designer isn't loading (it included the word comp) and I need to find and add the word comp back to where it is required. The error is
"The class frmuterDetails can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again. "
If I could go back to an earlier stage of my work that would be good too.
I have tried not saving and closing and reopening, didn't work for some reason it auto saved.
Ctrl + Z didn't work either it did up to a point but it didn't fix this error.
smaller issue than I thought I changed "frmComputerDetails" at the top to "frmmuterDetails" and then relaunched the project the designer worked but then of course things that called "frmComputerDetails" didn't so I changed the first class from "frmmuterDetails" back to "frmComputerDetails" and it works as normal.
:)

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

Weird debugging situation: "There is no source code available for the current location"

I have a Windows Forms application in a single project written in VB.NET 2003 (legacy code). There is a MainForm and a SecondaryForm that is run by the MainForm. When I run the application through the MainForm, I can debug without any problems.
However, if I just run the SecondaryForm, I get the debug error:
There is no source code available for the current location
when stepping over:
_routeId = CInt(myVar)
At this point I am no longer able to debug through my code window, but I have to use the disassembled code.
Why does this happen and how can I fix it?
My problem was of the Step-Into kind. I could step into a procedure inside a usercontrol just fine, but when its End Sub was encountered and I was leaving that Sub, I would get the "There is no source code available for the current location." error page.
The solution that personally worked for me was: In the Project Properties page, under "Debug", uncheck "Enable unmanaged code debugging".
I have seen this issue many times... and more often than not it is a reference(s) issue. Is it your code that has "no source" or is it Microsoft code? Do you have multiple versions of the .NET Framework installed?
Double check your references.