Blazor webassembly unable to put breakpoints - debugging

The goal is to be able to debug the client part of my blazor application. For this, in the sources accessible in the browser, I need to put breakpoints. The problem is that the sources are not apparent in the browser.
When I start my project in debug, I go to the localhost with the port of the sslPort property of the lauchSettings.json file
Then with Shift+Alt+D I will retrieve the instruction to execute.
I have the new window that appears, if I do Shift+Alt+D again I have the source tab that appears but there is no file:// folder as mentioned Debug ASP.NET Core Blazor WebAssembly in the Debug in the browser section
For information, at first I could not access part 2 because I had the following error:
websocket disconnected
I managed to make progress by following this post:
https://github.com/dotnet/aspnetcore/issues/26824#issuecomment-707825522
Has anyone encountered this error or have a clue?

I finally found the problem, but I don't know the real cause.
Below I explain my problem in case it can help someone, because I spent a lot of time to understand.
My post was intended but to help me put breakpoints in my client side code of a Blazor WASM application.
While setting the breakpoints in Visual Studio, I had an error telling me that the source code was not found, which is why I wanted to try the method through the browser sources.
I decided to go back to my original problem in Visual Studio.
I noticed that I can only debug projects that are stored in the source/repos directory in the folder. I tried in a VM, in it I can store my projects anywhere on disk.
On my pc, I found that Visual Studio is installed on disk C, but it also has settings on another disk, my 2 disk organization seems to be the cause. Because if I create or move the projects anywhere on the other disk, it works every time, if I take this project and put it on disk C, it doesn't work anymore. Unfortunately I didn't have the problem for a test project I created while trying to figure it out, so I see it can possibly be fixed.
To recap, if you have 2 disks with Visual Studio present on both, try testing on the other disk.

Related

Visual Studio 2015 debugging: Symbols cannot be loaded until I restart my computer

Recently, whenever I change something in my code, rebuild, and attempt to debug, I get the error "This breakpoint will not currently be hit, No symbols have been loaded for this document."
But then as soon as I restart my computer, everything is fine and I can debug properly. Why is this happening? It's really frustrating having to restart my desktop every time I try to debug my code. I've looked all over stack overflow and MSDN and can't find any solution to my particular problem. Any help is appreciated
"This breakpoint will not currently be hit, No symbols have been loaded
for this document."
(As for this error message, it's common error which has different causes. I can't give the most direct correct answer for this issue, I can only give you some tips for trouble-shooting. In order to avoid losing contact in the round-trip comments, I post those content as answer instead of comments.)
Since VS2015 have been released for long time, I would think this issue is a particular one, not found similar issues online.
First of all, please create a new simple project to check if this issue occurs in new project when debugging.
If it persists in new project, I think this issue has something to do outside environment like VS settings, VS config files or Debug options.
You can try:
1.Go Tools=>Import and Export Settings=>Reset all settings =>No,just reset settings=>Finish
2.Repair VS IDE since it seems to work well in the past, and just got the issue recently, so maybe something is broken for your IDE(In Control Panel find VS2015, right-click=>change=>repair). Also, make sure you have the latest VS2015 Update3 instead of earlier versions.
And if it works well in new project, then maybe the issue is about the whole project or solution itself. You can try:
1.Navigate to solution folder, close all vs instance, delete the .vs, bin and obj folders and restart VS to check if it helps.
2.Make sure you've loaded the required symbols, check the content in your Modules window during debugging, there's possibility you don't load necessary symbols successfully.
3.Check the output folder after your rebuild, check in folder like bin\debug folder if you have both the .exe and .pdb files. And make sure the .exe and .pdb files are up-to-date after your rebuild by checking their Date Modified.
Hope it helps and more info about the project type, dependencies would be better:)

Unable To Load Moved Visual Studio Project

I am in a real bind here. A programmer long before me made several applications in VS2010. We needed to move all these old applications to a file server so they can be backed up etc while awaiting updates. I am attempting to open this solution "Intranet". However, when I attempt this I receive the following error message:
\fs01\it$\Application-Source-Code\Projects-Important\Projects-Important\FFL Programs\Intranet\ :
error : Error opening web \fs01\it$\Application-Source-Code\Projects-Important\Projects-Important\FFL Programs\Intranet.
Unable to open the Web site '\fs01\it$\Application-Source-Code\Projects-Important\Projects-Important\FFL Programs\Intranet'.
The Web site '\fs01\it$\Application-Source-Code\Projects-Important\Projects-Important\FFL Programs\Intranet' does not exist.
We have a big customer coming in tomorrow morning and I need to take a look at the code to fix an error "a master page error". However, I cannot open this using VS2017 Version Selector. I have attached a screen shot of the sln file into to help assist with a resolution.
Option 1:
Copy your code from your file server (VS2010) see if it is opening/working on your local dev machine (in VS2010 orvs2017)
IF NOT
Option 2:
Still you'll need the above project files, now...
Create a blank solution in VS 2017 (relative to your programming language i.e. C# or Vb.Net etc) - also look for target framework
Locate the project file(s) (for e.g. ".csproj" files for c# projects) one by one manually.
Try to build the individual project( should there be any missing assembly references) and followed by complete solution build.
#NBaua, My brain has been overwhelmed lately. I was attempting to open a project when I needed to open a website. I just went to File --> Open --> Website and all works. Thanks again.

MVC3 Ap in Visual Studio 2010- Changed to use Local IIS Web Server and can not get it back to VS dev server

I changed from running Use Visual Studio Development Server to Local IIS Web Server becasue I read it would create the virtual directories properly - it did not - once I navigate out of the account area I get
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Requested URL
https://localhost:443/xxx/Index
Physical Path
C:\inetpub\wwwroot\xxx\Index
I have been googling and trying to get it to work, but can not and can no longer debug - Now I am trying to change it back and it keeps starting in Local IIS Web. I have HOSED myself and don't know where to go from here.
Thank you
In terms of getting back to using the VS web server you should just need to:
Right click on the web project in VS
Selection properties
Go to the web tab
Select "use visual studio web server" radio button
For the sake of not leaving questions unanswered, I tried all of the suggestions above, and many more, and got nowhere. I was in an early phase at the time, and I had to move on, so I ended up creating a new solution, and porting things over. Not the best idea, but I had to go forward, and I had taken enough time. It is still living on my machine, and I plan to go back and figure it out at some point. Hopefully, I'll have more understanding and will be able to post what I did wrong so someone else can save some time. Thanks all for attempting.

Visual Studio 2010 remote debugging: Debugging symbols are not loaded for this document

This is a weird problem, which luckily (?) also happens on other machines.
I've never had problems with debugging, and now I have: it shows an exclamation mark at my breakpoints which says :'The debugging symbols are not loaded for this document'.
The difference with other projects is that I run this web application in IIS:
I've created a new website in IIS 7.5 (win7), listening on port 80 to
local.comparer.nl
I've added the url local.comparer.nl to my hosts
file, redirecting it to 127.0.0.1
I've edited the start page of the
project (asp.net 3.5) to local.comparer.nl in 'use local IIS
webserver'
When I start the site, it first says 'unable to start remote debugging'. I don't know why it looks for remote debugging, but when I started the remote debugging monitor, it still didn't work.
When I unloaded the debugging monitor, it didn't complain about the remote debugging anymore, but the exclamation mark still was there.
Solutions which -sometimes- help at my colleagues pc's:
Delete everything from the \bin directory and rebuild
Rebuild again (n number of times)
Choose 'clean solution'
Any idea?
Are you building full debugging symbols? If not then the debugger has no information to relate the source code to the in memory activity under the debugger. This is set in the project properties per configuration.
Also ensure the symbols are in the bin folder.
You can validate that VS is loading the right symbols with the Debug | Modules window.
I had this issue bothering me for quite long. Finally, what resolved my problem is :-
1) Make Internet Explorer the default browser
2) Clean the solution
3) Build the solution
In my case I renamed an asp.net page and disconnected the code behind. Strange it still ran but did not run the code behind and therefore did not hit breakpoints in it.
You have to in Visual Studio 2010
Select "Build" Meanu > Clean [Project/Solution Name]
Rebuild [Project/Solution]
Try debug again... Good luck

"No symbols have been loaded for this document." But they have!

As you can notice
Symbols are been correctly loaded.
I just created a view GetCompanies.cshtml using the AddView shortlink
But, no matter what I do, I can't debug in the View.
What I did so far:
Close and Open Solution
Close and open Visual Studio
Shutdown all ASP.NET Development Server's
Deleted all Symbol Libraries .pdb
Clean Solution
Re-Build Solution
did not (yet) shutdown Windows 7 x64 :-/
Sometimes if you have a hard stop, Visual Studio temp cache will be screwed.
Clear the cache by deleting these folders:
C:\Windows\Microsoft.NET\Framework\<.net version>\Temporary ASP.NET Files\(ApplicationName)
C:\Windows\Microsoft.NET\Framework64\<.net version>\Temporary ASP.NET Files\(ApplicationName)
I am finding the same behavior from time to time when debugging silverlight. My solution is to clean the browser's cache (on latest IE click on the wheel button, Developer tools), as it sometimes will cache the binary files and not load the new ones.
Perhaps is could be the same with your views?
Been messing with this problem for a couple hours trying everything above. I finally changed my Target Framework to .NET Framework4.5 and it all started magically working.
This is always weird. I just had this problem and solved it with a full rebuild of the entire solution.
There was also another strange symptom, though: a new unit test that I had written using NUnit, mocking with NSubstitute, wouldn't pass because NSubstitute wasn't returning what I wanted it to return. I lost a few minutes trying to figure out if I did something wrong programming NSubstitute, then when I tried to attach the debugger to the NUnit GUI I saw that warning.
That's when I decided to do a full rebuild of the solution, and that worked for me.
So I guess the lesson to be learned is "before smashing your head against the wall, try a full rebuild".
For me, I somehow switched my target build to Release instead of Debug
Remember that views are actually compiled when you request the page (by default).
This means when you set a breakpoint in a view:
It shows the "No Symbols" error. This just means the view isn't
compiled yet.
It shows the breakpoint fine. This just means
that it found SOME compiled version of the page. Like the LAST working version...
So basically its not meaningful information to look at what it says when you mouseover the breakpoint in a view (at least in this regard)
If you are trying to debug this page, then you have a problem. Look at what the debugger is outputting to your BROWSER instead and fix that first. I think we'll be surprised about how many people are going to facepalm at this.
I had this problem with SL5 project (VS2012). And to fix this, I was needed to set "Silverlight" option enabled in %MyProjectName%.Web project properties, under Web tab.
In my case, the .PDB file was hosed (from which the symbols are loaded) in VS 2012, so performing a Clean and Build reconstructed the .PDB file and everything started workign again.
I was attempting to debug a deployed WCF windows services (compiled in Release mode) and had the exact same issue. Give this a shot...
Save All. You may even want to try to clean the solution
Rebuild all and install or deploy
BEFORE starting the service (or exe) I copied the .pdb files over to the install folder
Start the service (or exe) and attach the debugger to the process
Worked like a charm (finally) for me.
delete bin and obj directories
run solution again.
Note: Unless that cshtml loads at runtime the symbols are not loaded. On page load that breakpoint will be hit. So wait till control goes to that page

Resources