Can i debug a reference dll library i.e., i am not having the source code of that library in my solution. I will just add the dll by Add reference.
I heard that if the dll is built by enabling debug mode and by the use of .pdb file, the debug to the reference dll code can be performed.
Without source code? What would be the use? Well, there could be some, but very little. The PDB alone won't help you.—SA
If you don't have the source code, you cannot make a fix anyway. If you don't have the source code, you have reflected meta-data, but for debugging, you need to get inside the method and execute it line by line, and the body of a method is not a part of the meta-data, so what would you debug? In principle it's possible to debug on the decompiled code, but I don't think a standard debugger will do it. It can use disassembly, which is not the same as you will be debugging IL code instruction by instruction.
You can simply experiment with Visual Studio. Create two assemblies with all the debug options, referencing one by the other by the DLL name: When using "Add Reference", add it from the "Browse" tab, because it should build when you remove the source code of the referenced assembly. Physically remove that source code; renaming of the project directory will be enough. Check that the entry assembly still runs while calling some method from the referenced assembly, because it uses just the DLL file. Make sure a PDB is created and not deleted, as well as the DLL. Now for the important step: You need to close Visual Studio and load the referencing application again. Debug it and try to "Step Into" the method of the referenced assembly to be called: Set a break point at this call and run the application to stop at this break point and press F11. You will see: "There is not source code available for the current location", with the option "Show Disassembly". Do it: you will see the IL code, which you can debug stepwise. Not what you hoped for. And this is the case when you actually have source code and can
By the way, what is the situation when you don't have source code, but do have PDB. You can have it in the experiment shown above, but who will give you PDB file without the source? Again, does not seem to be a real-life situation.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)