There Is No Source Code Available For the Current Location

by Marvin 17. March 2010 07:34

For the most part, I love Visual Studio and programming using .NET, but this error makes me nuts.  I've run into it a couple of times recently when trying to debug.  I've learned a work-around today, so I'm documenting it here for my own future reference.

Background on the problem. 

I am debugging native code, not un-managed or third-party.  I'm using Fitnesse and some fixture code as a harness to launch into the code I am debugging.  I'm using System.Diagnostic.Debugger.Break() to fire up the debugger.  This approach has worked for me flawlessly for over a year on the same code-base.  I don't know why, now, I am getting this error, but oh, well.  Frustrating because I am ususally debugging to try to understand an error, and in the process I am getting another error and failure of the debugger.  When the fixture code loads, I get a Visual Studio dialog that says "There is no source code available for the current location."  I had no idea what the "Show Disassembly" button was for, but I clicked it.  The screen that comes up appeared cryptic and scary to me, so I immediately closed it.  

The Work-Around 

I found the work-around on MSDN here: http://msdn.microsoft.com/en-us/library/hdks6de6(VS.80).aspx in the comments section.  The first suggestion, deleting referernces and files and adding the reference back, did not fix the problem for me.  I've read elsewhere that you can delete .pdb files which I tried, but that also failed to fix it.  

However, I hadn't noticed that I can step through the disassembly which does eventually take me into my code.  If I click "Show Disassembly" and then "Step Into" my code (F11) just like I would have if the code window had loaded, I see my code mixed with other stuff.  I guess it's the compiled code.  Anyway, as I am step-by-stepping, when I see the code I want to debug, I just right-click the window and choose "Go to Source Code" which opens up the code and allow me to step through it, set break points, etc.  

Hope this helps someone else. 

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



About the author

I am a junior-level C# .NET developer living in Nashville, TN.  I'm currently working in biomedical informatics, developing a web service, a MySql database, and a web application.  Every week or so, I spend hours trying to figure out how to do something, and after I find the solution, I really want to make sure I don't go through that exercise again.  I love to write.  It helps me to remember things.  So, I use this blog as a way to document those painful lessons as I learn them.  It has already helped me to be able to refer back to them.  I hope some of these will save someone else some time as well.