As per MSDN, “a program database (PDB) file holds debugging and project state information that allows incremental linking of a debug configuration of your program.” Please note that pdb files are not specific to C#, they are available for .Net languages as well
Now let’s take a look at few common debugging related issues
My yellow highlighting does not match the code line in length
To fix this issues, rebuild the whole set of projects, using the code files which you intend to use for the purpose of debugging. Now redeploy the newly built binaries along with the pdbs to the deploy location. If it involves GACing, copy the pdbs to GAC as well. Open a new instance of CLR debugger or visual studio on the machine where the binaries were deployed and open the code files, which you used to compile the deployed build, in it. Now hook up the debugger and put the break points, you will see that the length of yellow highlight is equal to the code line length
How do I debug a windows service?
- Open a new Debugger(CLR or studio).
- Click on the Tools menu, and click on “Attach to Process” menu item
- You will get a list of processes that are running on the local machine
- Select the process that matches the name of your windows service and click on attach.
- Main function
- Constructor
- OnStart() method
What you can do is put a Debug.Assert(false); as the first line in your main function of the windows service and redeploy it. Now as you try and start the win service, you will get and empty Assert Window. Don’t dismiss it. Open up a debugger and hook up into the service. Put the break points at the suspect places and then dismiss the assert by ignoring it. The control will break at the breakpoint. Debug your service from here on
How do I debug an installer?
How do I debug an application hosted in IIS?
3 comments:
Nice tips. It comes only from experience, but posts like this can encourage new developers to go deep in to debugging.
Thanks dhawal. U rock..
Thank Mr.Dhawal,
This post is very useful.
When you want to debug a windows service using visual studio 2005
1. Go to Debug
2. Select Attach to Process.
3. It opens a dialogue box, select Show Process from all users. (It shows all the available process)
4. Then select the process.
Nice blog man. Keep posting such techie blogs.
Post a Comment