3

I have created a class library project which generates a nuget package with symbols and source. A webforms project uses this nuget package.

To debug the project, one attaches to the IIS process and sets breakpoints appropriately. This works fine with code that is within the same solution as the webforms project.

I would like to be able to debug code that is in the class library, either (case 1) through the original class library project and attaching to the IIS process OR (case 2) through opening the source file while in the webforms solution.

In case 1, I can access the source file fine and breakpoints even look like they would work (no error about symbols not loaded) - but the breakpoints are not hit.

In case 2, I don't know any way of loading up the source files. The best I can figure is stepping into the source files, which due to the structure of the application it is rather hard to do.

Is there any way to debug a nuget package by setting breakpoints right in the file instead of stepping into it?

Jeffrey Drake
  • 805
  • 10
  • 26

1 Answers1

1

In case you have access to solution which produced given nuget most straightforward would be attach to working process directly from it. Select Debug -> Attach To Process find process of your webform app - most often w3wp.exe and Attach. Best way is to use your locally built dlls for debugging.

In case you're running your webform app from solution as well you may run it with Debug -> Start without Debugging otherwise it may end with error that debugger is already attached.

Without solution with source code It should work as well. In case it don't work ensure that you don't have it excluded in Debug->Option->Debugging->Symbols->{All modules / Only specified}

Good troubleshooting guide for plenty of other causes is this post: How to debug external class library projects in visual studio?

I found out R# software enhances debuging options for consumed code a lot anyway even VS is capable to do so.

Community
  • 1
  • 1
Jaroslav Kadlec
  • 2,505
  • 4
  • 32
  • 43
  • I have tried to attach it from the project that produced the nuget. But it didn't seem to work - maybe the versions are slightly different. – Jeffrey Drake Dec 20 '16 at 19:45
  • You could try build that solution and use that output instead one from nuget. In case you have that solution acessible it should have same result – Jaroslav Kadlec Dec 20 '16 at 19:46