'Step Into' is suddenly not working in Visual Studio
Solution 1
With Visual Studio closed:
- Delete the solution's suo file (contains debug information, user settings such as break points, bookmarks, and other user settings.)
- Delete the Visual Studio cache files (see below)
- Delete all temporary files (a shift from VS9 to VS10 is that VS10 uses the temp folder)
- Manually delete all obj and bin folders using Windows Explorer.
Open Visual Studio and rebuild all. This always works. See C# VS2010 Entering break mode failed.
For reference:
Private Sub ClearVS9
ClearFolder(oShell.ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\VisualStudio\9.0\ProjectAssemblies")
ClearFolder(oShell.ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\VisualStudio\9.0\Recent")
ClearFolder(oShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\Local Settings\Application Data\ApplicationHistory")
ClearFolder(oShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\Local Settings\Application Data\Microsoft\VisualStudio\9.0\ProjectAssemblies")
ClearFolder(oShell.ExpandEnvironmentStrings("%WINDIR%") & "\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files")
End Sub
Private Sub ClearVS10
ClearFolder(oShell.ExpandEnvironmentStrings("%APPDATA%") & "\Local\Microsoft\WebsiteCache")
ClearFolder(oShell.ExpandEnvironmentStrings("%APPDATA%") & "\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies")
End Sub
See the link The evil suo file - fighting and winning with Visual Studio mentioned by JMarsch.
Solution 2
In my case, I was stepping into a method which yielded return of an IEnumerable
. In this situation, F11 may skip over the method until the IEnumerable
is iterated, since its execution is deferred until then.
Solution 3
My issue was that when I set a breakpoint the code would properly stop at that point but when I pressed F10 or F11 the code would simply finish running instead of going to the next line. I also noticed that while the code was stopped at the breakpoint I could not use my cursor to hover over my variables to see their values. Here is how I corrected the problem:
- With the project open but not running make sure the Standard tool bar is displayed (it probably is because it's the default)
- Look at the drop down list in the toolbar that has the options Debug, Release, Configuration Manager. Select Debug from this list. Mine was set to Release
Solution 4
Visual Studio does not step into the code when it cannot load the symbols (.PDB file) of the DLL.
Below, there is a link to an article and some screenshots that explains how to discover where visual studio is trying to load the PDB files. Once you find out which directory you have, just copy the .pdb files there and Visual Studio will step into.
https://devblogs.microsoft.com/devops/understanding-symbol-files-and-visual-studios-symbol-settings/
Modules Window --> Debug > Windows > Modules
Solution 5
Your F11 key may be rebound to something else. It may work if you click the step-into button in Visual Studio.
Nick LaMarca
Updated on February 09, 2022Comments
-
Nick LaMarca over 2 years
All of a sudden, I have run into an issue where I cannot step into any code through debugging in Visual Studio. The step over works fine, but it refuses to step into (F11) any of my code. This was working before, now all of a sudden it does not.
I've tried some things below, but I still had no success:
Delete all bin files in every project in my solution, clean solution, re-build solution.
Build projects in solution indivdualy
Restart machine
It an ASP.NET C# application consuming a WCF sevice locally. It is in debug mode. I have a breakpoint set on the page consuming the service. The breakpoint hits, but it will not step into the service code.
The ASP.NET site and the service code is all in the same solution. This all of a sudden does not work, it did work before.
How can I fix this problem?
Adding a breakpoint to the service project I get a warning:
Breakpoint will not currently be hit. No symbols have been loaded for this document.
I deleted all the bin folders for all the projects and re-built them one by one. They all succeeded, but still I am getting the symbols won't load on any breakpoint I put into any project in the solution other than the ASP.NET project where the breakpoint works. I was able to debug step into all the projects before, this is an all of a sudden thing.
Information from the output window..
'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\SMDiagnostics\v4.0_4.0.0.0__b77a5c561934e089\SMDiagnostics.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.DurableInstancing\v4.0_4.0.0.0__31bf3856ad364e35\System.Runtime.DurableInstancing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml.Hosting\v4.0_4.0.0.0__31bf3856ad364e35\System.Xaml.Hosting.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2d49cf50\14eee2cf\App_Web_jmow15fw.dll', Symbols loaded. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Discovery\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Discovery.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Routing\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Routing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Channels\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Channels.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
-
Admin almost 12 yearsOk it might be that your debugger is not loading the PDB file related to your module's dll. Here is a good post If you are still facing the problem, please check it. Good Luck.
-
Nick LaMarca almost 12 yearsIt says: WebDev.WebHost40.dll C:\windows\Microsoft.Net\assembly\GAC_32\WebDev.WebHost40\v4.0_10.0.0.0__b03f5f7f11d50a3a\WebDev.WebHost40.dll No No Cannot find or open the PDB file. 3 10.0.40219.1 2/18/2011 10:09 PM 03100000-03112000 [3204] WebDev.WebServer40.EXE: Managed (v4.0.30319) Cannot load symbols, but where are the symbols located?
-
Admin almost 12 yearsHave you read the post I mentioned above? While debugging in Visual Studio, click on Debug > Windows > Modules. The IDE will dock a Modules window, showing all the modules that have been loaded for your project. Look for your project's DLL, and check the Symbol Status for it. If it says Symbols Loaded, then you're golden. If it says something like Cannot find or open the PDB file, right-click on your module, select Load Symbols, and browse to the path of your PDB.
-
Nick LaMarca almost 12 yearsIt has symbols loaded on the asp app consuming a wcf service. The only thing that doesnt have symbols loaded is this webDev.WebHost40 this all worked in the past and now doesnt. The degugger hits breakpoints in asp app but wont step into the service code
-
Nick LaMarca almost 12 yearsWhat am I to do in Properties/Web tab of the WCF project?
-
Nick LaMarca almost 12 yearsI deleted all the bin folders for all the projects and re-built them 1 by 1 they all succeeded but still getting the symbols wont load on any breakpoint I put into any project in the solution other than the asp.net project were the breakpoint works. I was able to debug step into all the project before, this is an all of a sudden thing.
-
JMarsch almost 12 yearsNear the bottom, there is a set of checkboxes -- make sure that the box to enable asp.net debugging is checked.
-
JMarsch almost 12 yearsBased on your last comment, definitely check on that debuggging settng that we have written about. I have once or twice had that box come mysteriously unchecked (maybe another dev checked it in that way, and didn't take credit, maybe there is some bug lurking in VS that causes it).
-
Nick LaMarca almost 12 yearsYes it was checked in the wcf services project
-
JMarsch almost 12 yearsI'm afraid that the best I've got then are the other 3 steps -- make sure that it is loading the assemblies that you think it is (2), check the config (3), and that suo file -- when it gets corrupted, VS does all sorts of unfortunate things.
-
Nick LaMarca almost 12 yearsI have even took the time to create a blank solution add new projects into it one at a time and then add the existing files and references to the projects. Still the same result
-
Nick LaMarca almost 12 yearsThe confgiuration manager has all the projects checkboxes checked under the Build field
-
JMarsch almost 12 yearsIs debugging for the web service enabled in the web.config (this separate from the checkbox that we talked about previously): msdn.microsoft.com/en-us/library/e8z01xdh(v=vs.100).aspx
-
Nick LaMarca almost 12 yearsYes <compilation debug="true" targetFramework="4.0"/> is in the web.config of the service project
-
JMarsch almost 12 yearsCould be some environment setting, I suppose. Try this: In VS, go to Tools | Import and export settings | and choose reset settings (there is an option in the wizard to back up your settings -- do that so that you can restore by using the Import settings option if this doesn't fix it)
-
JMarsch almost 12 yearsOne other thing -- Open the .csproj file on your client program. Check the physical path to your web service project and make sure it's correct. Also, check the URL that you are using in your web reference and make sure that it is pointing to the same project -- the 2 most common cases I have seen where you get the "breakpoint will not be hit" message are where the target project is not building, or the path to the target project is different from the path in the solution.
-
JMarsch almost 12 yearsAnd yet one more thing to check: are there PDB files for your web services project?
-
JMarsch almost 12 yearsAnd one more: I'be been assuming that your web service project is a Web Application. Is it a Web Application or a Web Site? (I don't have much experience troubleshooting Web Sites, because they have always been so problematic, that I always start with a Web Application.
-
Nick LaMarca almost 12 yearsReset Settings didnt work and I do see a pdb for the service project in the that projects bin folder..
-
Nick LaMarca almost 12 yearsHere is what the csproj file looks like ( I added it to main question body), I do not see any information about the service in it..
-
Nick LaMarca almost 12 yearsBoth the service project and the website are web application projects to start
-
JMarsch almost 12 yearsWhat web server are you using for debugging? IIS Express? Cassini? "Real" IIS?
-
Nick LaMarca almost 12 yearswhatever comes out of the box with visual studio..localhost
-
Nick LaMarca almost 12 yearsI used to be able to debug..this is a new revelation out of no where and I cannot seem to know what I coulda done to make this not work. I can debug the top level but it wont step into the projects anymore
-
JMarsch almost 12 yearsFor both the web service and the web app projects, right-click on properties and go to the Web tab. Check which option you are using for the web server (Options will be VS development server, IIS, and, if you are running 2010 with SP1, IIS Express). If you are not using one of the development servers, try switching to one of them. If that fixes it, then the problem is probably in config options for the full IIS. If not, then I'm still not sure what's going on.
-
Nick LaMarca almost 12 yearsIts using VS development server
-
JMarsch almost 12 yearsTHe only thing left that I can think of is to check the URL for the service. Check both the service reference on the client, and the URL as it appears in the service application's config, and make sure that they match. Here's my guess: Your service-side breakpoint is displaying as "will not be hit" because casini has not loaded it (it has no reason until you hit it, and I can repro that behavior), but then, your client-side web app is hitting the wrong URL, so casini is never loading the service.
-
Nick LaMarca almost 12 yearsMy service project has a web.config but I do not see where the service url is?
-
Nick LaMarca almost 12 years<endpoint address="localhost:1374/OrderService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_iWebServices" contract="ServiceReference1.iWebServices" name="BasicHttpBinding_iWebServices" />
-
JMarsch almost 12 yearsIf there is nothing in web.config in the service (and if you are targetting .net 4.0 -- NOT 3.5), then open the properties for the web service project. Go to the Web Tab, and look at the port number and virtual path assigned to the web app (virtual path is probably just "/"). Your service url will be localhost:(the port number)/(the virtual path, if there is one)/YourService.svc
-
Nick LaMarca almost 12 yearsI changed it from the "/" now I keep getting this error and I cant get rid of it even if I put the "/" back in .. Server Error in '/localhost:1374/OrderService.svc' Application.
-
Nick LaMarca almost 12 yearsServer Error in /http: //localhost:1374/OrderService.svc Application. Is the error
-
Nick LaMarca almost 12 yearsI think the virtual path is all messed up now. How do I reset it?
-
JMarsch almost 12 yearsThat should be all it takes to reset -- I verified on a project here. Make sure that you are changing the right project. Try stopping the development web server (in your task tray). If all else fails, you could edit your csproj file, and look for the <DevelopmentServerVPath>/</DevelopmentServerVPath> tag --it should just contain the forward slash.
-
John almost 12 years@NickLaMarca: As you might know, the dll you're referencing is the Cassini web host. I don't believe there's a need to have symbols loaded for this. If it's not a web application code file, the code file/project you're setting your breakpoint should be the module you're looking for in the modules window. If you find that, you can start working on getting the correct symbols file loaded.
-
John almost 12 years@NickLaMarca: Also, you're not trying to step into a property are you? There's a setting for this operation as well in the debugging options.
-
Nick LaMarca almost 12 yearsI am stepping into methods not properties. All this worked before then all of a sudden stopped stepping in, I cannot figure out why this could be? Breakpoints used to now say "Symbols not loaded" in the service project but now they do
-
John almost 12 yearsYou've probably not changed this, but have you checked under the project properties for the service, advanced build settings, under output? Is debug info set to full?
-
John almost 12 yearsMight as well go ahead and check Options/Debugging/Symbols and make sure that looks okay as well (All modules, unless excluded, etc.).
-
Nick LaMarca almost 12 yearswe are talking about the project with the service in it correct?
-
Nick LaMarca almost 12 yearswhere is the Detailed log file I look at this stuff located at?
-
John almost 12 yearsThe output window's detail is what I was referring to. Set the output as I mentioned and this is the log information I'm referring to. If your service project is what you're not able to debug, then that's the one I'm talking about rebuilding with verbose/detail logging to output window (among the other suggestions as well to this project, e.g. debug configurations mentioned). Then, this service application (that you can't step into), look for that service's assembly name (AssemblyName.exe) and look for the pdb, e.g. AssemblyName.pdb and the actions I mentioned, in that verbose output.
-
John almost 12 yearsThe output you posted is not what I was wanting you to look for, rather something like: Task "Copy" Copying file from "obj\Development\YourAssembly.pdb" to "bin\Development\YourAssembly.pdb". This line would indicate that it did build the symbol file and shows where it should be.
-
Nick LaMarca almost 12 yearsI am not sure where to find that information. The information posted is what was in my output window
-
John almost 12 yearsSee above: "Set the project's build output to detailed or verbose (Tools/Options/Projects & Solutions/Build & Run/MSBuild project build output verbosity)." This information will be displayed in the output window after you rebuild the project.
-
Nick LaMarca almost 12 yearsAll those items checked out to be fine
-
Nick LaMarca almost 12 yearsI am not sure how to use this code. Do I just create a console app with your ClearVS2010 routine and run it? What does ClearFolder look like?
-
AMissico almost 12 yearsIt is part of a script, use it as a reference only. From the Run dialog, just type the environment variable and press Enter. That will open Window Explorer. Navigate to the folders then delete the files.
-
Nick LaMarca almost 12 yearsI tried to just click the step into button in vs but still same result
-
Axxelsian almost 12 yearsAre you able to use the step-into function in other projects or is it just within this project that step-into does not work? It might just be a VS core problem.
-
Matt over 10 yearsI've edited this answer. Read the update to see how to use it. In a real world scenario, you might want to replace the popup by a delete statement to remove the files, not just display the paths.
-
Matt over 10 yearsIf you want to add delete code, you can find an example here.
-
Ajay Sharma almost 9 yearsThanks, Only Delete SUO file and temp folder is enough to make debugger runnable.
-
AMissico over 8 years>>Delete SUO file and temp folder is enough<< Not always.
-
Mike Burger over 6 yearsMy case was similar, but it was just that I was never using the results of the IEnumerable, so even though it ran, it never got to the break. Once I added an additional line that used the results of the IEnumerable, all of the breakpoints were hit.
-
Martin Braun over 2 yearsYou can find the window at
Debug > Windows > Modules
while debugging.