Breakpoint Problem in VS2008 - asp.net

I have an ASP.NET web site project that I want to debug, but when I try to debug it Visual Studio gives the message "The breakpoint will not currently be hit. No symbols have been loaded for this document". Does anyone know of a solution to this that does not involve reinstalling everything.
Debug is enabled on those files.
Edit: manually loading symbols did not work.

Make sure that the assembly that contains the code you are trying to debug is compiled in Debug mode and that PDB symbols are included. Then rebuild the solution and try running again.

You need make sure that you the .PDB files (symbols files) that was generate during the compile time. you can load the symbols manually if needed.

Best way to check if PDB loaded:
Pause execution in debugger using pause button;
Open Debug windows Modules;
select module you are interested in and check location from where it is loaded. If you have PDB file for this module you can load it;
Most common issue with ASP.NET modules are loaded not from your bin but from cache or some other folder.

I found a solution to my specific problem: The startup project was different from the project with the breakpoints, and when I set the startup project to that project the breakpoints worked again.

Related

Unable to debug web page code but can debug code in global.asax

When I put a breakpoint on the page_load of the starting page, I receive the following message.
"the breakpoint will not be hit. no symbols have been loaded for this document."
I have seen this before and usually resolve this by cleaning the solution and running it again. This time, however, I am not able to find a solution. What is even stranger about this time is that if I put a breakpoint in global.asax such as Application_BeginRequest, the breakpoint does hit and I can debug, this happens for any page that I add breakpoints to.
If I go to menus\Debug\Windows\Modules I can see that the web app DLL was not built with debug information.
While debugging, 2 things that let breakpoint work correctly consist of .dll and .pdb file. If you look at your bin folder of your project. These 2 files will placed together and must have same "date modified" which mean it was created together while building.
If these 2 files are not created together in whatever reason. Some line-of-code of some files will not hitted by break point. You can also see while debug by navigate to Debug > Windows > Modules. Then find your target dll that you want to debug such as YourApp.dll. Then see in symbol status column. If it work correctly, I will show Symbols loaded.
This may occur in many reasons such as you have changed something in your code (this case may be your aspx file) then you debug without build.
To fix this, You can go to Tools > Options > Projects and Solutions > Build and Run at "On Run, when projects are out of date" set as "Always build" to ensure your project always be built before going to debug.
My issue turned out to be related to the AOP framework PostSharp. I uninstalled it and re-installed it and everything is now properly debugging. By the way I love PostSharp and I highly recommend it. However, I wanted to post my issue and resolution in case someone is experiencing the same issue and is currently using PostSharp.

How can I make MSVC debugger step into Qt library source code again?

Until now my Visual Studio 2008 debugger gracefully stepped into Qt library code when I pressed F11. After upgrading Qt to the latest version and changing QTDIR, F11 does not step into library code anymore. Any clues how to make the debugger smart again?
Activate the modules list, Debug - Windows - Modules, to see what libraries are loaded and if debug symbols are loaded for those libraries. Note that you need to have the debugger active on your process to be able to do this.
In debug mode, the Qt libraries should be suffixed by d. QtCored4.dll for instance. If you see QtCore4.dll on the list, you have linked to the wrong libraries. If it does say QtCored4.dll but under Symbol Status there is something different than Symbols loaded., then that's the reason. You can manually load the symbols here by right clicking on the dll and selecting Load Symbols. It asks for the Pdb file after clicking that.
You can add more pdb file locations, if they weren't loaded but exist, from Tools - Options - Debugging(tree) - Symbols(tree). If you want the symbols to be automatically loaded.
Should it give some error, that the pdb file doesn't match the binary or something like that, you should re-build your Qt debug version, unless you have more pdb files to try. Use the Visual studio command prompt and go to the Qt directory, run configure and nmake. It takes a while, possibly some hours. There was some switch to only build debug version but i forgot where it goes. Note that the build might fail and after that it's a lot of fun www.google.com searches. The best bet might be to get the source only package, I forgot where to get that and it's not easily found. If you know where to get it, tell me please. I vaguely remember that there might be some other way to build the debug version, but this is the only one i know for sure.
#0xbaadf00d's recommendation to "open the Debug/Windows/Modules view" for verifying which modules have loaded successfully and which are not loaded is extremely useful.
Here is a summary of what I check when I need to step into Qt source code:
The DLLs must be for the Qt version in developer's Qt kit
The Qt .pdb files must be present in Qt kit's folders: bin, lib, plugins/platforms, plugins/qmltooling
Visual Studio Tools/Option/Debugging/Symbols needs paths to .pdb files:
If qt.conf file is used, must point to correct bin folder
If target is WinCE or WEC2013 and using HKLM\Loader\SystemPath, you must specify path to DLLs in SystemPath variable
Set the location for the source files in the project property pages:

VS2010 pdb lock error when modifying a css file

In one of my VS projects I get this error when I modify a css file in a App_Themes catalog in runtime.
CS0042: Unexpected error creating debug information file '[..]\Temporary ASP.NET Files[..]\App_Theme_MySite.pdb: The process cannot access the file because it is being used by another process.
I've used the Process Explorer and concluded that the file is being locked by the devenv.exe file.
In order to proceed I have to restart the entire project.
It only happens in this one project and I have been unable to find what differs from other projects where I don't have this problem.
Solution running, css modification, solution crashes.
Any ideas?
I'd similar issue.
Just remove the attribute or change it false.
<!--web.config --><configuration><system.web><compilation optimizeCompilations="false"
Found solution too....after 6-8 hours...

No dll compiled in visual studio 2008 express when built

I'm a .NET newb, so forgive me if this is a stupid question. I've inherited a website which I've amended and now need to rebuild. I've opened the .sln file in VS2008, made my changes to the files and clicked 'build > rebuild website'. This seems to run okay - it outputs a load of comments in a panel at the bottom as it's building, and then finally stops, saying: "Validation complete. Rebuild All: 1 succeeded, 0 failed, 0 skipped".
But when I check the bin folder, there are no dlls in there.
Does anyone know what's going wrong here? I just need to build this thing and upload the aspx and dll files and it should be sorted, but just can't seem to get it to build properly at all.
Thanks for any pointers...
If its a web project and not a web application then Visual Studio does not actually build and compile it. It just checks through for errors and let's the runtime itself compile the web pages and code behind. So you won't get a dll in the bin folder.
You can try pre-compiling your site and copying the output up to your web server.
Cheers Tigger.
Make sure you're looking in the right bin folder. It's not the one in solution explorer, and you need to make sure you're checking using the "Release" configuration bin folder and not "Debug".
It's entirely possible they are redirecting the build output to somewhere else.
Check the project properties (right click on the project name and select Properties).
On the "Compile" tab look to see what the Build Output Path is. That is where the assemblies (dll's) are going to be pushed to.
Try Click on Solution right mouse ant choose Build solution. It rebuild all your solution files not only the web page.
Go to the 'Build' menu at the top of Visual Studio and select 'Build Solution'.

Why am I unable to Debug my ASP.NET website in Visual Studio?

I used to be able to attach to my w3wp process and Debug my web application, but this is not working anymore. I have no idea what changed to break this. I'm using Visual Studio 2008 SP1. And I'm debugging in IIS, not using ASP.NET's own server (i.e. I don't Run my project, I simply attach to a running process (w3wp).
My breakpoints simply have the "breakpoint will currently not be hit. The source code is different from the original version."
What I have tried:
Did a solution Clean.
Did a solution Rebuild.
Made sure that compilation debug=true in my web.config file.
Deleted the bin folder
Restarted Visual Studio
Restarted IIS
Restarted my Computer
Added a simple Response.Write to ensure that the latest DLL is being used. It is.
Made sure that Debug ASP.NET is checked in my project properties. It is.
Made sure that all my projects are compiled in my build configuration. They are.
But none of these help. I attach to w3wp, but my breakpoints never get hit.
Any ideas?
I had this problem recently and I ended up first making sure Visual Studio was not running at all on the system.
Then went into this folder and deleted all its content:
C:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
Check your web.config for
<compilation debug="true">...
When you "Attach to process", the Output window should show you (when showing output from "Debug") all the libraries it's loading, and where it's loading them from - for the dll's in your /bin folder these are usually copied to the \Temporary ASP.NET Files\root\ folder - where are yours being read from? Have you definitely cleared them out from there?
The only other things I can think of:
You've compiled your code in "Release" mode rather than "Debug" (not the web.config) from the Solution Configuration drop-down.
The symbol files (.pdb) are missing from your /bin folder.
On the "Build" tab of the project properties, you are in configuration "Active (Debug)", you haven't check "optimize code"?
If you click "Advanced..." on that tab, what value do you have for "Debug Info"? Is it "full" or "none"?
Responding to comment
You will find it harder to debug successfully if your code compiled in "Release" mode, and you'll often get the "source code is different" message when you've not rebuilt the symbols (.pdb files) after changes - but you say you've done a clean/rebuild, so that should cover that.
Yes, your output window will show all the framework dlls that you're referencing as well as your code - but you should see one file listed in there with the name of each project output - those are the ones to look at.
You don't have some post build event that moves files into the correct directory for your site do you that's silently failing?
I also had this problem, solved it by changing the "Attach to" code type to Automatic on the "Attach To Process" dialog. (Previously I had this set to "Silverlight Code" due to debugging a different process... it can be easy to forget to change this back.)
I know this issue has been open for some time, but I think it is the same as I experienced:
I could not debug my .aspx server side code. I had a working WepApp AnyCPU project and I wanted to link to some x86 dlls, so I created an x86 debug target. Did similar things, rebuilt, stopped the development web server, rebooted, clear temporary files, all to no avail.
Fixed the problem by changing the target folder to bin\ (was bin\x86\Debug).
Are you running any add ins that could be affecting this? Or any tools that apply post build operations to the source code that the DLLs you start debugging with have been modified post build and it actually is correct that it's not the same source code so debugging won't work?
Also have tried resetting VS?
devenv.exe /resetsettings
Edit: if none of the information has aided you here, while painful it might be worth uninstalling and reinstalling VS and SP1. If you go through this and the issue is the same afterwards that atleast assures that the issue lies in either the web.config or the project settings.
Did you check your assembly.cs file with this attribute
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.Default)]
After reflecting a optimized code you will probably get this. So you must remove this to be able to debug again.
I faced the same issue. The w3wp process took a lot of memory and did not want to be reset on web application publishing.
Press Ctrl+Alt+Delete > Go to "Processes" tab > find w3wp process and
kill it. Run the app again (if this is an mvc app, just go to a
related url to automatically recreate w3wp process).
Warnings will disappear after that.
I have tried all the below options in my Visual Studio 2013 Update 4.
Reset IIS
Clean solution and rebuild
Delete the friles from temporary folder
C:\Windows\Microsoft.Net\Framework...\Temporary ASP.NET files
Check whether the compilation tag is debug or not
But none of them worked, here I am listing down the two things which worked for me.
Disabling the "Just My Code" option
Tools ->Options -> Debugging -> General -> Uncheck Enable Just My Code.
Edit the web.config file and save (You can always create a space in any line
in web.config, that will do)
Please be noted that this solution can be Visual Studio version specific, and the both fix worked for me in my Visual Studio 2013 Update 4.
in the "Attach to process" dialog, click the checkbox (near the bottom) for "show processes from all users" and if you see two w3wp.exe processes, try the other one.
One should have a comments/description value of something like T-SQL, managed somethingoranother. This is the one you want.
I have had this problem for a while and found my solution on the MS forum (link below).
Debug Diagnostic Tool was the culprit for me, but I did not have to uninstall it. I had a crash rule set up for the w3wp process and I simply removed that rule and restarted everything.
Microsoft Forum for Unable to attach error
On OpenVMS we just used to:
Compile/Debug then Link/Debug
and that was it! Simples!!
but seriously, make sure the file you have your Debugger.Break line in, has 'Copy always' set in its Properties before re-building
I was using the Visual Studio extension VSCommands to attach the debugger (convenient). However, IIS Express was running, and I guessed it might be interfering. Sure enough, when I closed IIS Express, suddenly I was able to debug again.
Joy ensued.
In my case I had a Console Application the hosted web page in .Net Framework 4.6.1. When I added a Debug to Conditional compilation symbols, it started to work:
Make sure that "Current Page" and not "Don't open a page. Wait for a request from an external application." is checked under Properties->Web->Start Action.
add this code in your .csproj file
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>false</Optimize>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

Resources