Search code examples
visual-studio-2017visual-studio-debuggingc#-6.0

Browser Window Opens While Stepping Through Linq Query - "Source Not Found"


I have been writing a project with no problems, using F11 to step through the code as necessary to debug. About a week in, Visual Studio 2017 has suddenly decided to stop allowing me to step through certain portions of the code.

When I get to a linq query that is referencing my Entity Framework Model (based on a SQL database), it brings up a browser window asking me to locate a file; (in the picture below, rttype.cs). All of the other lines of code I tried can be stepped into without a problem; I have not tried every line.

Browser window that pops up during debugging

I also get a new page open in VS saying rttype.cs not found. The item not found varies if I choose to step through different portions of the code - I guess several of the objects it needs cannot be found.

In terms of the advice found online, I have deleted the .suo file, removed the bin and object folders, cleaned the solution and rebuilt it, deleted and re-made the EF Model and tried to find the VS chache files, but the problem persists. I also checked the linq itself, which seems to work fine so long as I don't try to step through the code.

A lot of the advice suggests deleting the visual studio cache files, but I am worried that this will cause other problems with TS etc, and in any case I can't find advice on how to do this for VS 2017 (lots of advice for older versions!).

What would you recommend to try to diagnose the cause of this problem and fix it?


Solution

  • F11 is Step Into, aka. shows you the code inside the current line (if available).

    F10 is Step Over, aka. just run the code in the current line.

    If you push F11, the IDE will attempt to show you the code behind the line you're looking at. Since the next step in your line involves something inside the .Net Framework (for which you only have the assemblies but not the source code) the IDE asks you with the dialog box to show it where you downloaded the source code for the .Net Framework.

    I suggest using F10 instead when the debugger's next step isn't something written in your solution.

    See also this link, which gives information about debugging only user code with Just My Code: https://learn.microsoft.com/en-us/visualstudio/debugger/just-my-code?view=vs-2017