“No symbols loaded for the current document” ASP.NET C# Project - c#

What to do now, this time??
I hate VS and this symbolic gibberish that never seem to have same solution (if it once was logic) twice. The screendump below says what it says.
As soon as I F5/Start the web project, the breakpoint going yellow. This ONLY affect the aspx.cs file that being changed. The other aspx.cs files can have breakpoints.
When I do rebuild/build all DLL and PDB files are created just fine. They have same compile time and are in same directory. Module-Windows i VS says the symbols are loaded perfectly. Well, yeah, try bite me!
I can tell, all symbolic is working just fine, until I was about doing changes inside those aspx.cs files (which was some time ago since last time). If I reset back the file, the breakpoint are working. If I try to make changes in another file, the problem appears there.
It simply appears like that the symbolic file generator don't understand changes maded in aspx.cs files..

Have you got compilation debug="true" set in web.config?
http://msdn.microsoft.com/en-us/library/e8z01xdh(VS.80).aspx

This sometimes happens if you have changed the starting url in the Web -> Start Action -> Start URL to a different location. It could also be something in the Web -> Servers pane where something is set other as expected.
Also make sure the website in IIS (if you have configured IIS) is located to the right directory (where your project builds the output), otherwise it can't start debugging either.

I've found a good hint (see my comment higher in this thread).
The WEBAPP have, as seen above, an _dll path.
This _dll path are there because this project has dll files shared with other projects. This means save space and don't have copies of same files for several projects.
Though,
This raise problems beause the webapp still are output/copy files to it's own sub bin/ directory. And even worse, not ALL needed dlls, which make error when the running web project (due to missing xxWeb.dll, which copies to _dll bin).
Accepting the fact to use standard bin/ fixed the problem this time. Why? The answer on that will not be in this thread, sorry. Someone with an idea would course make a comment here. In general, this isn't a drawback because the webb project binaries should be at the end of reference tree..

Open Visual Studio Command Prompt
and Run devenv /resetsettings

Related

Breakpoint will not currently be hit because source code is different in razor code

Here's the error message that I'm getting on a breakpoint in my razor code:
A copy of index.cshtml was found in App_Web_cmi1k1de.dll (Server-side
symbols), but the source code is different from the version built into
App_Web_cmi1k1de.dll (Server-side symbols). To allow the breakpoint
to be hit when the source is different blah blah blah...
I was getting a very similar error message and I went to the Configuration Manager in my solution and found that one project wasn't set to "debug." I changed it to debug, cleaned out everything in C:\Users\me\AppData\Local\Temp\Temporary ASP.NET Files\root\932eeb02\b9cdc481\, and rebuilt my solution. I see that now in this folder I see a
C:\Users\me\AppData\Local\Temp\Temporary ASP.NET Files\root\932eeb02\b9cdc481\App_Web_cmi1k1de.dll
together with a
C:\Users\me\AppData\Local\Temp\Temporary ASP.NET Files\root\932eeb02\b9cdc481\App_Web_cmi1k1de.pdb
These two files have identical timestamps, down the second. Any idea why I'm getting this error? It doesn't make any sense that the source code would be different than the compiled .dll.
Stop debugging, check that the IIS (or IISExpress) process is no longer running - stop it if required, in Visual Studio right-click the solution Clean, then rebuild. Try debugging again.
Visual studio on your view file, right click properties, Copy to output directory: Copy if newer or Copy Always
None of the above worked for me. Restarting VS did not work either. Turned out to be related to a recent change I had made to another file. Even though that complied OK, when I undid the change, the error went away.

Debugging previously compiled ASP.Net Web App without visual studio

So, I've had to rework a web app on one of our servers, a legacy app, that needed to get new branding via a common master page, where it previously had none. The page displays ok, but there's a form on it that calls a method in a compiled dll which allows the user to download a document. This throws an error, but the error is vague (mentioning a null reference). We have the source code but I don't have visual studio installed on my machine and even if I did we suspect it may have something to do with the server environment, and the server is not set up to run project files, just compiled web apps. One of my colleagues thought that by removing the dll, the app would just use the cs files and compile that at run time. That didn't work, and another colleague suggested turning debugging on in web.config, which we did, but still no go. He also mentioned that debugging required pdb files, but I don't see any in the source code we have. If I could get this working on the server just using the cs files vs. the dll, I could at least attempt to debug what's going on, any ideas on how to get that working?
There seems to be a good deal of confusion here about how ASP.NET applications work.
First, .CS files are meaningless to IIS. IIS knows about files containing markup. It also knows that the assemblies contained in the bin folder represent the server-side code that handles the incoming requests and generates the outbound responses.
In most cases, when a site is deployed to a production server, the .CS files are not included, because they are just noise on the server, useless file clutter that have no bearing whatsoever on the execution of the application.
Now, you're kind of lucky, because you have the source files there. You can, actually, force a recompilation of the cached assemblies. To do this, open the site's web.config file and add some whitespace (a single space) to the end of the first line. Then save the file. This will cause ASP.NET to clear its cache and rebuild the site.
This isn't guaranteed to get rid of your problem. Like you say, the problem could be somewhere else. What I would strongly suggest is that you download the site in its entirety, install Visual Studio (get a free express edition if you have to), and DEBUG the darned thing.
If you can't run it in a debugger and watch it execute, you're just guessing.
PS If this thing isn't under source code control, get it there, ASAP.

Can't rebuild my application anymore

I'll give you 2 versions of my problem to describe it, first the short version.
When I try to build my application it does that perfectly and my app works but when I try to rebuild it, that fails and gives an error message saying that 2 files are missing (bin/debug/MusicPlayer.exe and bin/debug/MusicPlayer.pdb). When I then try to build normally, it fails to with the same error.
Now the longer version:
The way this happened was quite out of nowhere, I program on 2 different locations (both in Visual Studio 2010 sp1) but to always have the recent version in the right place I copy the entire solution folder to a usb stick, this folder I copy over again on the other PC and use it to continue were I left off, I've done this many times without problem. Yesterday however, I got an exception while testing the app. But instead of showing this in my code, it was complaining that it could not find the program.cs file (it was there, but apparently it had a different checksum (md5) and it asked me to use this one. After a while I found what part of my code caused the exception and fixed it. Since then I haven't got that error anymore. But when I later tried to rebuild instead of build, it gave me the error described in the short version. I have tried to fix it, but apparently I was not very successful.
Basically, what I think it does is delete the files in the debug folder that need rebuilding and then gives me the error of missing files (the files that it deleted) and thus failing to rebuild succesfully because these deleted files the normal build option won't work to.
(What I then do is re-copy them from my usb to make the normal build work).
Don't know if it's important, but I program in C# and I'm still learning.
Also when I copied it to my usb I believe I had no errors and the app was working fine (except the part I fixed later, which I could not test at that location). And when I build the entire solution it gives some warning ==> "Assembly 'bun/debug/MusicPlayer.exe' is incorrectly specified as file" and this for 5 files.
Does anyone know how to fix this rebuild problem and if necessary the warnings?
Thanks in advance
(and sorry for my bad English)
OK it seems like you might be confusing yourself with your directory structure here. If you want to add Content or Resources (Images, Text Files, etc.) you should place them in a folder within your project (not called bin or obj). All your build files will go here. Instead place the Content in another folder and Right Click -> Properties and Set the build action to "Content" or "Resource" and set the Copy to Output Directory (bin folder) to "Do not Copy" or "Copy if newer."
The project is failing because you have the built executable "MusicPlayer.exe" in your project. So Visual Studio is trying to build an executable file in adding to the project. Restructure your directories or remove "MusicPlayer.exe" ever time your build your project.
Do you have any anti-virus software running? They can go way too aggressive on removable drives. You are actually continuously deleting and creating a runnable program on usb stick by recompiling.
Just a guess tho...
Sounds to me like you have a pre- or post-build event with a hardcoded path in it. Fix that using variables and it should be ok.

Unexpected Error creating debug information file GG.PDB"--"

When I try to build my project, it returns the following error:
Error 1 Unexpected error creating debug information file 'D:\Documents\Lance\Documents\School\Capstone\GG\GG\obj\Debug\GG.PDB' -- '' GG
I've recently had the misfortune of having my PC restart on me, due to sudden power supply problems (maybe). This is while the project was building, before this problem started.
When the PC came back online I've noticed that the changes I've made to the program prior to the sudden power down was not saved. And, it won't build anymore.
This worked for me:
Shut down VS.NET
Browse to the project in Windows Explorer
Delete the /obj/ folder.
Delete the project outputs (.dll and .pdb) from /bin (not sure if this step is necessary)
Can't hurt but might help: delete the project outputs from any other project /bin folders in the solution that is having issues (wasn't necessary for me)
Restart VS.NET
Rebuild
http://weblogs.asp.net/ssmith/archive/2003/08/12/23755.aspx
As requested, my comment as an answer:
Try cleaning the solution (under the Build menu in VS).
Since the build was interrupted half-way through by your power failure, the file isn't locked -- the build system is probably just in an inconsistent state (which a Clean Solution should fix).
This happens once in a while in my environment and the problem probably has to do with the PDB file being locked (i.e., I'm guessing the last part of the error message is missing in your post). This is how it looks on my machine:
Unexpected error creating debug information file 'c:\dir\obj\file.PDB' -- 'c:\dir\obj\file.PDB: The process cannot access the file because it is being used by another process.'
In my case, cleaning the solution does not solve the problem and restarting is an overkill, so I usually just copy the full name of the pdb file (from the error) and execute this on the command line:
ren c:\dir\obj\file.PDB *.old
This worked for me: Close Visual studio and open visual studio using Run as Administrator and problem was solved.
Not need to restart or delete the file.
Just rename the file and that is enough. If you try to delete the file it will give an error. Better just rename it & it will work. :)
If you are having this problem with a web application, this can happen in the unusual situation that you have used DebugDiag and created a rule that listens on your project's app pool. Deleting the rule prevented this problem from recurring.
This might happen, for example, if you followed these instructions for diagnosing a stack overflow exception in IIS.
If you are working on VM with two user, make sure the other user has not attached all the process while debugging.
Cons of restarting VS:
Clipboard will be lost
Redo/undo will be lost
Files open will be lost
You will loose the tempo
Solution:
Give your Assembly a new name. No cons. Except you will have to rename your assembly back to its original name when you are ready for final deployment. And I think anyone can find how to make it work for the last time :)
Sometimes all the files from \bin folder are used by a running process, i.e. web site on IIS or windows service run automatically after build. In such cases turning off the service or stoping IIS app pool for specific site should also help (like in my case)
Sometimes I run into this problem, when compiling the same project for (very) different targets:
VS2008 and net35
VS2017 and net462
dotnet core 2.0
My guess is, that either bin and/Or obj directory are used by the compiler, but the outputs are not compatible (of course). Solution clean from VS indeed helps.
Often we specify different dll names for the output (e.g. mylib.dll, mylib35.dll) and the issue never happened on those projects.

Breakpoint not hooked up when debugging in VS.Net 2005

Been running into this problem lately... When debugging an app in VS.Net 2005, breakpoints are not connected. Error indicates that the compiled code is not the same as the running version and therefore there's a mismatch that causes the breakpoint to be disconnected.
Cleaned solution of all bin file and re-compile doesn't help. Not just happening on a single box or person either.
Added Note:
This solution is in TFS for Source Control. If I delete my local TFS repository and get it from source control from scratch, SOMETIMES the problem goes away. I've also tried un-installing and re-installed Visual Studio. That also SOMETIMES helps. That fact that both of those work some of the time indicates that the problem isn't caused by either directly.
Maybe this suggestion might help:
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.
I've found that it's sometimes necessary to:
stop the debugger
close the IDE
close the hosting application
nuke the obj and bin folders
restart the IDE
rebuild the project
go through the Modules window again
Once you browse to the location of your PDB file, the Symbol Status should change to Symbols Loaded, and you should now be able to set and catch a breakpoint at your line in code.
Source: The breakpoint will not currently be hit. No symbols have been loaded for this document.
http://dpotter.net/Technical/2009/05/upgrading-to-ie8-breaks-debugging-with-visual-studio-2005/
In Options -> Debugging you can uncheck "require source files to exactly match the original version", which may help.
Is the build configuration set to Release?
Do you have a reference to an external DLL where the breakpoint is set?
Are you creating a DLL project that is consumed by an external executable? Are you using .NET or COM?
If you are using the COM Interop with .NET, the DLL versions can sometimes be a problem when the executable loads the DLL. For instance, if your daily build cranks out an incrementing build number but your debug DLL has a smaller build number, the executable won't load the debug DLL. To fix this, you will need to scan the HKEY_CLASSES_ROOT\CLSID directory in your registry for the GUID/CLSID of your .NET/COM component. Under InProc32, delete entries with a higher version number than your debug DLL.
Again, the above only applies to .NET + COM Interop DLLs.
I've had a similar problem in the past.
It was solved by closing Visual Studio and deleting the temporary ASP.NET generated assembly files for the project under "C:\WINDOWS\Microsoft.NET\Framework{framework version}\Temporary ASP.NET Files", re-opening the project.
Read the post here and the comments to resolve it.
AviewAnew - had already done that at the request of the MS tech person. It didn't help to uncheck require source file to match version.
Mike L - configuration is set to DEBUG and there are now external DLL. Using all local projects except framework references.
Are you sure the .pdb files are in the same folder as the executable you are running? Make sure the last modified date of both files match, and that VS is attached to that exe (and no other).
Do you have a post build step that touches your binaries in any way? If so, this can confuse the debugger and make it look like your symbols don't match your exe/dll because of the incorrect size/timestamp.
In the past I have sometimes found that switching off compiler optimisations can solve 'missing' breakpoints, as the optimiser had determined (correctly) that the code was not being called, and removed them from the compiled versions.
This does sound like a different issue, but it might be worth making sure that optimisation is switched off in Debug mode. [Project / Properties, Build settings tab]
Sure there are no Debug attributes on the code that prevent code from being debugged, such as DebuggerHidden or DebuggerStepThrough, at any point of the application?
Can you step through your code up to the line of the breakpoint instead of running and waiting for it to hit? Can you step through code at all?

Categories