1

I have a web application project which references a class library project dll. The class library resides in a different solution.

I want to debug the class library by setting breakpoints in its own project. Upon googling it, I did the following:

  1. Unchecked "Enable Just My Code" in the debugging options.
  2. In the Debug-->Options-->Symbol tab, I deleted the locations other than Microsoft symbol services. Deleted the cache directory and emptied the cache.

By the way, I am hosting the web application on IIS and the debugger attaches the the IIS process.

So the problem is, with this configuration, when I start debugging and look at the Modules window, the symbols for the class library are loaded from a directory starting with "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files...". But that is wrong. It should be the directory of the class library.

In order to fix it, I tried deleting the pdb at that location. It seemed to work at first sight, VS loaded the right pdb from the right location. But as I rebuilt the class library so that my breakpoints will be in effect, the symbol location again reverted back to the Temp ASP.NET Files directory.

How can I achieve the right result?

John L.
  • 1,825
  • 5
  • 18
  • 45
  • did you see [this](https://msdn.microsoft.com/en-us/library/ms366723.aspx) – Nilesh Aug 09 '17 at 20:50
  • The problem is not where the pdb is located, The pdb targets to your source code, you can even check that out opening the pdb with notepad – hardkoded Aug 09 '17 at 20:52
  • Why don't you just add you class library project to the solution where you have your web project? The project can be member of any number of solutions. And set back all the options to default – T.S. Aug 09 '17 at 21:08
  • @Nilesh I am a little confused. So what about the bin-->debug folder. That is the directory I am mapping the IIS virtual directory to and do my tests. – John L. Aug 09 '17 at 21:23
  • @T.S. I would like to do that if I could add them as read-only projects just to debug. But other than that, having the project under soure control in one solution and being able to manipulate it from other solutions seems a little error-prone to me. – John L. Aug 09 '17 at 21:29
  • Your fears are baseless. "Read-only projects, source control..." Why you even mention this? This is not how it works. There no read-only projects. I don't even work off the source control solutions. I work from local solution that I can delete and recreate by copying one. I import projects into it. These projects can be part of different solutions. The only time when you need to work from source control solution is when you add nuget references. There could be deviations when you add nuget references. But to debug, you don't need to work from SC based solution. – T.S. Aug 09 '17 at 22:14
  • @John L, Like this case here: https://vijayt.com/post/debugging-a-class-library-in-a-web-application/, I also suggest you debug your project locally. If you want to debug it using the IIS, I know that we also need to use the attach to process, but you would make sure that you really load the matched pdb file or the correct path for this dll like this case: https://stackoverflow.com/questions/23039976/debug-dll-of-website-running-under-iis – Jack Zhai Aug 14 '17 at 07:12
  • @John L., What about this issue? Could you debug your app now? – Jack Zhai Aug 28 '17 at 06:58

0 Answers0