Getting rid of "There is no source code available for the current location."
Asked Answered
E

17

40

OK, this is my own fault, but I can't seem to rescue myself.

Whenever I try to step into a class that has fields with assignments calling into .NET code, I get a dialog box that contains the text "There is no source code available for the current location.":

Screenshot of error message

For instance, stepping into the constructor of the following class would give me the above message:

public class Test
{
    private Stack<String> _Dummy = new Stack<String>();
    public Test() { }
}

I assume this is because at some point I fiddled with the settings for the symbol server, but no matter what I fiddle with now, I can't seem to get rid of that message.

Where has my stupidity forgotten what it did?


Summary of my current options:

  • [ ] Enable address-level debugging
  • [x] Enable Just My Code (Managed Only)
  • [ ] Enable .NET framework source stepping
  • [ ] Enable source server support
  • Symbol file .pdb locations - empty
  • Cache symbols from symbol servers to this directory: C:\temp (empty)
Egwan answered 24/11, 2008 at 14:44 Comment(3)
Same problem here. Can you still remember how you got rid of it?Pansir
I have the same problem, but unlike you, I don't even want to use the source sever, just want to get rid of this message already!Theodora
None of the solutions here worked for me, but I found a solution and have posted it here.Tunable
E
29

See if some source files are accidentally excluded. Do properties of the solution and look at the Debug Source Files section under Common Properties.

Elongate answered 6/3, 2010 at 13:50 Comment(1)
Actually, I'm getting this error trying to step into code that is in the same fileThrottle
W
26

In Solution Explorer, check your solution property page under Common Properties, Debug Source Files. If you see the assembly listed under "Do not look for these source files:", delete it and the issue should go away.

Open the solution property page

Screenshot of right clicking on the solution in Visual Studio's Solution Explorer

Check "Do not look for these source files"

Screenshot of the solution property pages in Visual Studio solution

Williamsen answered 20/11, 2013 at 12:58 Comment(3)
I needed to "Rebuild" rather than a "Build", then this worked.Antigua
It might be hilarious, but I closed Visual Studio, after re opening I cleaned and build my solution again. It worked!!Smalltime
Is there any way files can get automatically added to the "Do not look for the source files" list? I was able to step into a file yesterday, then come today I couldn't and it was in that list.Glogau
O
13

If you do not want to debug .NET assembly, a quick fix to avoid "No source available to current location" problem is to uncheck "Require source files to exactly match the original version" check-box under Tool -> Options -> Debugging -> General

Oread answered 18/8, 2010 at 9:22 Comment(1)
Hi msbyuva After unchecking the above check box option. Close the Visual Studio and restart it. Don't forget to re-build all source code. I hope it solves your problem. It worked for me.Oread
L
5

Here's what I did to solve this problem. First, stop debugging and just have your solution open in VS. Next, make sure your solution config is set to Debug as opposed to Release. Then simply do a Rebuild (not Build, Rebuild). The next time you fire up the debugger, it should function as normal and you shouldn't get that error message.

Hope this helps!

Ludicrous answered 11/6, 2013 at 19:47 Comment(0)
O
4

If you don't want this annoying tab to appear, you can try this add-on that I created: http://erwinmayer.com/labs/visual-studio-2010-extension-disable-no-source-available-tab/

It is directly downloadable on the Visual Studio Gallery: http://visualstudiogallery.msdn.microsoft.com/en-us/fdbb2036-471e-40a7-b20e-31f8fd5578fa

Osbourne answered 15/4, 2011 at 18:31 Comment(0)
S
2

Check if your projects have a project reference, not a DLL reference! If there exists a DLL reference, your changes will not be recognized by your referenced project, and you will get an error message like yours.

Sponge answered 24/11, 2008 at 14:50 Comment(0)
K
2

This error made me go crazy as well. I was using 'AjaxControlToolkit' and had referenced it using 'Add Reference' to my project.

I deleted the 'AjaxControlToolkit' reference and added the same with 'Add Existing Item' and after that I had no problems at all...

Kathie answered 24/8, 2011 at 11:21 Comment(0)
C
2

I had the same problem in an unmanaged C++ program: when debugger was in main function it always showed "No source code available" and, what was interesting, other functions in this file was shown without problems. In this case, the problem was that I allocated too much data on the stack. After reducing it, the debugger started to work without problems.

It was in Visual Studio 2010.

Cockleboat answered 25/5, 2012 at 7:36 Comment(0)
T
2

One way, that also works for Express Editions of Visual Studio (say, Visual Basic 2005 Express Edition), is to rename the .suo file. It is in the same folder as the solution file, .sln. Exit Visual Studio before renaming the file.

Screenshot of Windows Explorer with a .suo file highlighted

The .suo file contains non-critical settings, like window positions, etc. However, it also contains all the breakpoints which is why it is probably better to rename it than delete it in case this action is regretted.

Tunable answered 27/1, 2014 at 18:41 Comment(0)
D
1

This is how I solved it.

Right click your project -> Properties - > Compile -> Advanced Compile Options...

Then Set 'Generate debug info' to 'Full' from the drop down menu.

Hope that helps.

Derbent answered 29/4, 2014 at 14:34 Comment(0)
B
0

This worked for me:

  1. Check the "Enable Unmanaged Code Debugging" on the properties page for the referenced *.DLL
  2. Recompile referenced *.DLL
  3. Remove and then re-add the referenced *.DLL to your project
Build answered 5/1, 2012 at 16:24 Comment(0)
C
0

Have you tried to build that page? I had an issue with something similar with AjaxControlToolkit: Modal Popup Extender. It did not show until I gave it CSS and ASP.NET controls.

Chandra answered 10/7, 2014 at 0:28 Comment(0)
E
0

I had for some reason disabled all the Common Language Runtime Exceptions in VS 2017.

To fix this, open the Exception Settings under Debug > Windows > Exception Settings and mark the checkbox Common Language Runtime Exceptions in the Exception Settings window

Escape answered 16/5, 2018 at 18:41 Comment(0)
Z
0

I had the same issue, It showed me that the error is on AjaxControlToolkit, but the problem was in my HTML syntax, especially in a div tag, I was putting only the close tag '' without the opening tag

Zollverein answered 14/11, 2019 at 15:0 Comment(0)
S
0

I ran into this problem because of difference between framework versions of test projects and main projects. When upgrading main projects frameworks version, be sure to not forget to upgrade test projects.

Senator answered 9/11, 2020 at 8:48 Comment(0)
G
0

I had this problem in VS 2017 C++

TLDR: It was accesing data beyond the limit

The program finished in debug mode and it showed this message: wntdll.pdb not loaded

After fixing it with this answer it started to show the message: There is no source code available for the current location

But also there was a message that popped saying: app.exe has triggered a breakpoint, but the breakpoint was not in my source code, it was in the source code generated by VS in debug mode, Right click in the source code -> Go to Disassembly and the break point was int 3 instruction

At the end it was just a stack overflow, since the code was accesing data beyond the limit, I just fixed the code and the messages were gone

I guess VS didn't show an error about accesing data outside the limit because I was using Winapi function GetEnvironmentStrings() and in the site says: Treat this memory as read-only; do not modify it directly and I was modifying it :)

Gobbledygook answered 13/2, 2022 at 3:34 Comment(0)
L
-1

I had the same problem, and I solved it on this way (Visual Studio 2008):

"Formato de la informacion de depuracion" to "Base de datos de programa (/Zi)"

Enter image description here

Leavelle answered 12/2, 2015 at 15:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.