Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET "There is no source code available for the current location"

Status
Not open for further replies.

borgtank

Programmer
Nov 10, 2003
4
US
Working with a small VB .NET project that I'm not able to debug anymore. I'm able to set breakpoints in some areas of the code but not others. All the code is in one file for a single form. Some sub routines I'm able to step into, one I get an error message of "There is no source code available for the current location" getting a disassembly window and others are ignored entirely.

The project is in debug mode, tried deleting the files in the \bin directory forcing them to be recreated and the Microsoft staple of rebooting. Any suggestions?
 
It is hard to diagnose your problem from the limited info given, but when something like this happens in vs it can sometimes be fixed by creating a new project and pasting code from your old project into the new one.

Are you by any chance using threads?

 
No this is just a single thread. The program is just parsing a .CSV file. There are 2 sections of the file that I need the information from and dumping the rest. There is a private sub that is the main loop that reads in each line of the file. When it finds one of the two sections it calls one of 2 private subs that parse the information.

The "No source" error happens when putting a breakpoint on only one of the lines calling the parsing routine from the main loop. The other works fine and there is very little difference between them. I've tried coping all the code into a new project, replacing the code with the working routine with the one that has the issue and even tried renaming the routine.

This morning I noticed something interesting. When I put a breakpoint in the parsing sub it runs like nothing is there. I then put in a message box with "hello world" one line above the breakpoint that was just skipped with a breakpoint on it as well. The code runs, a message box appears and the code will break on the second breakpoint never see the one on the line calling the message box.

 
Are you opening up the single file instead of opening a solution (.sln) or a project (vbproj) file. If you just open the .vb file you will get these type of errors. If you dont have a solution or project file then create a new project and add the .vb file to your project.

DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb

-----------------------------------

If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
I only notice that problem when debugging events. I'm able to iterate through all my subs and functions no matter where in a solution they are. But I have to specifically set breakpoints in events or I get that error message...

Dwaine
 
All the code is written into one vb form but it is in a project.

OK, this is going to sound crazy but since coping everything to a new project didn't work I tried deleting the solution file (.sln) forcing it to recreate it. The code will now break in the sub without a message box but not step into it from the main loop.

The other day I created two timers on the form with both set to enabled = false. In the form load one was enabled waiting a couple of seconds then setting the timer enabled to false and calling the sub that is the main loop. The other was set to call end after a few seconds if anyone was reading the information put on the form to entertain them (general info about what was processed). Deleting the first timer and calling the main loop from a button or form activate, everything works fine. The problem went away.

This code could have been written in just about anything but seeing how it was a small project I figured it would be a good place to start looking at .NET. Who would have thought that having a timer calling a sub to start the process would effect how debugging works on part of the code. If you have any ideas I would like to hear them.

Thanks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top