Break point not working and modules not loading dll files in VS 2010 - visual-studio-2010

I am using VS 2010 professional [64bit - Windows 7] and in my solutions, i have 3 class library project and 1 wcf service projects are there. All these dll's are refereneced in my WPF applications. For the last 1 year, it was working fine and i was able to debug the all the referenced projects. But from yesterday itself, debug is not working all of a sudden.
When I put a break point on a class in the wcf project, it says breakpoints cannot hit as the source file is different from....etc.
When I checked in the Debug --> Windows ---> Modules window, all those projects dlls are not seen there and says no pdb files are available ???
But in the WPF bin\Debug folder, i have all the referenced dlls and their pdb are ther.
What could be the problem ?
Even I am not able to debugg the wpf project as well. For getting break point or debug, each time i have to clean the solution or project then rebuild it again. Then i will be able to debug the WPF project.
In the case of referenced dlls, I removed the dlls and added the new compiled dll again and copied that pdb files to the wpf project exe folder. Still no use !!!!
I have changed the options in the Debug and Options [disabling and enabling the Just my code options etc]. But still it is not working.
This is not only my problem. One of my colleague also have this problem we took the whole latest solution code from TFS. SO I changed the Local code path to a new folder and took the latest code from TFS again. Still the problem exists !!
I am able to run the application. But debug is not working. In the WPF project, all those dlls are referenced properly.
Can anyone help us ???

I guess I don't have enough points to comment to ask specifics, so this may or may not solve your problem but I'll take a crack at it. Also, there appear to be other questions about this. So I would check those out first to see if they will help.
This question was solved by adding configuration to tell the program which version of the framework to use during debugging.
Why doesn't VS2010 debugger stop at my breakpoints?
Why does Visual Studio 2008 skip over my break points?
If those don't help, I'll give it a go.
When I put a break point on a class in the wcf project, it says breakpoints cannot hit as the source file is different from....etc.
This sounds like it could be one of the following issues:
Remote debugging and Visual Studio does not know where to load the symbols from or they are out-of-date
Need to clean and rebuild (which you seem to be doing)
The server you are running your WCF service on is not getting the updated DLLs and PDB files. If it's IIS Express, try killing the process between builds.
Also, make sure you are building in Debug mode and not Release mode. While building Release mode will generate the PDB files if it's set to do so which will allow you to debug an application, the code may be optimized as well which can cause breakpoints to be missed.

Related

The application was unable to start correctly (0xc000007b) when copying from one project to another

I'm using MS Visual studio 2010 and openCV 2.4.8.
I get the following error when I execute some project.
Suppose I have a solution which contains only 1 project. That was built by me.
And, I have one other solution created by someone else and there are 2 projects in it. Out of the 2 projects created by that person I chose one and I copied the required header files, cpp files, DLLS and everything and put them in my project.
Then I get the above error.
Both the projects works fine when executed separately. Have I made a mistake in copying ? Or else, is there something else behind this ?
to solve this problem you should copy the DLL files from the direction of opencv like C:\opencv\build\x64\vc12\bin to the debug or release file in the project files
The problem is due to 32/64-bit mismatches of various system dlls required by Visual studio. Somehow the dlls it needs got replaced by 64-bit versions that it couldn’t load.
Replacing the dlls mentioned below from a machine that is working, solves the problem:
c:\Windows\SysWOW64\msvcp100.dll
c:\Windows\SysWOW64\msvcp100d.dll
c:\Windows\SysWOW64\msvcr100.dll
c:\Windows\SysWOW64\msvcr100_clr0400.dll
c:\Windows\SysWOW64\msvcr100d.dll
The Application was unable to start correctly (0xc000007b). Click OK to close the application" when starting Visual Studio 2010
I've found another solution of this issue. In VS window you can just change the machine type from default 'Win32' to 64-bit (default 'x64').

Breakpoints don't hit and/or Cannot find or open the PDB

Breakpoints don't hit and Cannot find or open the PDB
My breakpoints aren't hitting in a known good class. I know the class is working becuase the data is flowing through. They worked yesterday. I also tried a class that I haven't touched in weeks (another known good) and the breakpoints wouldn't work there either.
I have:
- Verified I am building in debug mode
- In my solution > Properties Configuration Properties > Configuration I verified each project is set to Debug and Build
- Went to Tools > Options > Debugging and disabled "Enable Just My Code"
- Cleaned and rebuilt the solution
- Restarted Visual Studio
- Rebooted my computer
I have the Modules window open in Debug. Many of my modules show "Cannot find or open the PDB file." Many show "Symbols loaded" (that is good.)
For the files that do not have matching PDBs I right-click and go to Load Symbols From > Symbol Path. Of course there is no PDB in the symbol path. When I right-click and go to Load Symbols From > Microsoft Symbol Servers I get nothing. I have searched the root of my drive looking for these specific PDBs.
Here is an example of the affected DLLs:
Microsoft.CSharp.dll
System.EnterpriseServices.dll
System.Runtime.Serialization.dll
System.Web.WebPages.Deployment.dll
System.Web.ApplicationServices.dll
Based on what I found online the PDB issue is realated, but if I can hit my breakpoints withouth PDBs then I'm happy.
I checked out: Visual Studio 2010 "Cannot find or open the PDB file" with no joy.
I would really like to hit my breakpoints.
Thanks!
PDB files should be in the bin directory along with your other files. They are created when you compile your project. If they are not there, you may have turned them off even while in debug mode. For Vb, look under MyProject->Compile->Advanced Compiler Options and make sure Generate debug info is set to Full. Not sure what the analog in C# is though.
Also for a web project, I had this problem when I had a release version running in the same app-pool as my debug version. Try using a dedicated app pool for your debugging if that's the case.
OK, this is totally embarrassing... I wanted to step through my web services, but to do so I needed to send information from my client application. I had my client app pointing at the wrong server. Bummer.
.Net Reflector can generate the PDB files for most assemblies referenced in your project. I have found it to be extremely helpful.
http://www.red-gate.com/products/dotnet-development/reflector/
Once installed, in Visual Studio: View > .NET Reflector Object Browser > Right click assembly and 'Enable Debugging'

Visual Studio breakpoints only work on second debug attempt

I have a VS 2010 solution with a web application project, and several class library projects to which the web app project has project references. When I am trying to debug the code for one of the class library projects through the F5 debug build process, the Modules window normally fails to load the symbols for the DLL in question, or if it does, the breakpoints are ignored anyway. However, on the second attempt at an F5 debug build, the breakpoints usually are recognized, and the code will halt in the required location.
I have tried ALL sorts to fix this issue - all the usual solution cleaning business, repeating the referencing procedure. I didn't see this issue until I upgraded to VS 2010, after which I rebuilt a new VS2010 solution from existing projects. I am beginning to think this is some sort of timing bug in 2010, as I am making no changes between the first and second attempt - it's as though VS 2010 is disregarding the dependendencies in the build configuration, and starting the web app build before the PDB for the class library is ready, or before it can locate the PDB for the class library.
Has anybody seen similar behaviour in VS2010? As you can imagine it is adding considerable amounts of 'productivity killing' time to my debugging, having to build everything 2 or 3 times just to get the breakpoints to be recognized.
Thanks if you can advise.
Try erasing the bin and obj folders between runs. does it help?
I have similar issues with a web server which does not get changes made to the configuration file on VS2010.

Visual Studio 2010 - Debugging / Build Problems

I am using Visual Studio Professional 2010 and the Team Foundation Server Express (beta). My VS Project (C#.Net / WPF) has been migrated from VS 2008 (without TFS) to VS 2010 (with TFS).
Whenever I apply changes to my code and try to debug my application, I get messages like This breakpoint will not be hit. (in german: Der Haltepunkt wird momentan nicht erreicht. Der Quellcode weist Unterschiede zur Originalversion auf.) and the project is started using the old executable version (the one with the last successful build). No errors occure, the code is OK, but the changes are not applied either.
When I manually cleanup and rebuild my project, everything works quite fine - but there has to be a fix for this issue?
Edit: I just added a new project to my VS solution and checked it in on the TFS Server. Using this new project the problem does not occure. Even when I add the same dependencies I used in the project mentioned above, the debugging and building of the new project works fine without the errors mentioned above.
Maybe this information helps you to lead me to a solution.
It's not clear whether existing answers are not sufficient. I can't know exactly what's causing your problem; but, I can detail some places this potentially comes up.
The first area that I commonly see this is when a project references an assembly directly. You can create a project that creates an assembly. Another project might use that assembly and you can reference by assembly directly (and not add a reference to the "project"). This disconnects VS from really knowing it needs to "build" that referenced assembly first and it will sometimes get out of sync with the debugging symbols (PDB). You can tell if a project has been referenced or an assembly has been referenced in the properties of the reference (expand References in Solution Explorer, right-click a reference, and select Properties). A referenced project will not have a Specific Version property, while an assembly reference will. You can sometimes also tell from Project\Project Dependencies. If you have a reference to an assembly generated by another project but that project isn't a dependency in Project Dependencies, it might be an assembly reference. To fix this, you can usually just delete the reference and add a reference to the project.
I've also find that sometimes breakpoints confuses the debugger. If I have many breakpoints or they've been kicking around a long time, the debugger sometimes does some weird things. If I delete all the existing break points (Debug/Delete all breakpoints) and re-apply them the debugger is usually much happier.
You can find the answer here. The assemblies might be in GAC or a project or some projects need to be rebuild to generate the pdb files again, which are used for debugging. If you don't choose to rebuild it might use the old pdb files.
My guess is that you are putting breaking points somewhere your program can't access them.
Ex:
const int x = 5;
if(this.x == 1)
//do sth <--- breakpoint here
If you are running a mixed mode application (unmanaged native C++ & managed C#), make sure to set Enable unmanaged code debugging in your C# application's Properties window.
You have to rebuild, there isn't an easier way around it.
The program database files (PDB) need to be recreated. You should also have your configuration setting set to debug.
Also the first answer to this question must be of help as well.
This happened to me when I started VS as an admin, and it also happened to me when the project is set to a different architecture than a DLL that I used in this project.

Visual Studio 2010 SP1 - C# PDB file corrupt - shows wrong line numbers

I have a problem with a single C# project in a solution of 21 C# projects (ANY CPU).
Break points aren't hit - and when I force the debugger to attach (Debugger.Launch()), I can see that the call stack shows the correct functions however the line numbers are very wrong.
In a concrete example, I have a break point in line 346 of 1020 lines - but the debugger navigates to line 10745 which results in the debugger showing results from a totally different file. From log files I can see that the correct methods are being executed.
After much headache I therefore chose to try on 2 different machines with VS 2010 SP1 installed - and these showed the exact same behavior.
I have already tried to do a full clean of the solution, manually delete all PDB files, restart VS, restart the machine, emptied the VS Symbol Cache (Tools > Options > Debugging > Symbols), removed all "Symbol file (.pdb) locations" and delete the solution's ".SDF" database.
I am compiling the project in Debug mode, and have verified that "Optimize code" is not enabled on the project.
Break points in different projects in the solution does work - so it seems it is only this one project that for some reason generates a corrupt PDB file. However, I can't really see why this single project should differ from the other projects. The only real difference is that I have 2 web references in this particular project - and funny enough it is in these stub classes that the PDB file always instructs the debugger to end up.
The particular solution is being compiled and debugged on a fully patched Windows 2003 x86 machine.
I would appreciate if anyone could give me a hint how to solve this problem.
Try right click on the project, go to the build tab->click advanced button->check output area->select debug info to pbd-only. Sometimes it changes.

Resources