balexandre
balexandre

Reputation: 75073

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

As you can notice

enter image description here

Symbols are been correctly loaded.

I just created a view GetCompanies.cshtml using the AddView shortlink

enter image description here

But, no matter what I do, I can't debug in the View.

What I did so far:

did not (yet) shutdown Windows 7 x64 :-/

Upvotes: 18

Views: 40809

Answers (10)

Nagesh ajab
Nagesh ajab

Reputation: 1

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

Upvotes: -1

Worthy7
Worthy7

Reputation: 1561

Remember that views are actually compiled when you request the page (by default).

This means when you set a breakpoint in a view:

  1. It shows the "No Symbols" error. This just means the view isn't compiled yet.
  2. 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.

Upvotes: 1

Serj Sagan
Serj Sagan

Reputation: 30198

For me, I somehow switched my target build to Release instead of Debug

Upvotes: 1

MoMo
MoMo

Reputation: 8200

I was attempting to debug a deployed WCF windows services (compiled in Release mode) and had the exact same issue. Give this a shot...

  1. Save All. You may even want to try to clean the solution
  2. Rebuild all and install or deploy
  3. BEFORE starting the service (or exe) I copied the .pdb files over to the install folder
  4. Start the service (or exe) and attach the debugger to the process

Worked like a charm (finally) for me.

Upvotes: 0

any
any

Reputation: 91

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)

Upvotes: 9

Brian
Brian

Reputation: 3693

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.

Upvotes: 0

Anton Kedrov
Anton Kedrov

Reputation: 1767

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.

enter image description here

Upvotes: 0

burhop
burhop

Reputation: 139

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.

Upvotes: 3

s.m.
s.m.

Reputation: 8043

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".

Upvotes: 1

Palantir
Palantir

Reputation: 24182

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?

Upvotes: 7

Related Questions