Unable to debug SharePoint solution (Webpart+UserControl)

Sanjay Chauhan 61 Reputation points
2022-03-01T08:55:12.073+00:00

I have a SharePoint on-prem(2013) solution on Visual Studio(2013). Solution contains various projects, Web part(Not visual web parts), User Controls, Custom pages, Class library.

On Properties Window -> Site URL for User Control and Web part projects is set as local IIS site address. But actual site is running on HTTPS where web part and user controls were deployed.

When I am trying to debug the code from User Control but I am getting breakpoint exception.

"The breakpoint will not currently be hit. No symbol have been loaded for this document."

So I am not able to debug User Control code.

Please help me how to fix it.
Thanks in Advance.

Microsoft 365 and Office SharePoint Development
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sreeju Nair 12,666 Reputation points
    2022-03-01T09:44:14.2+00:00

    To debug SharePoint solutions, you need to configure certain settings. Make sure in web.config of your SharePoint site, you have the following settings

    1. Custom Errors to off
    2. Compilation debug to true
    3. CallStack to true

    Refer the details in the below link

    https://learn.microsoft.com/en-us/visualstudio/sharepoint/debugging-sharepoint-solutions?view=vs-2022

    0 comments No comments

  2. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2022-03-02T06:42:32.057+00:00

    Hi @Sanjay Chauhan ,
    Per my research, this problem usually occurs because the web application is not able to pick up the .PDB from the Temporary ASP.NET Folder. You can refer to following steps

    Check if you are not in release but in Debug.

    When in debug:

    First try rebuilding your project by right mouse click the project > Rebuild If that doesn't work, try a clean of the project (right mouse click on the project > clean)

    If that didn't work check this:

    Right mouse click your project

    1. Select [Properties]
    2. Select the [Build] tab
    3. Make sure [Define DEBUG constant] and [Define TRACE constant] are checked
    4. Make sure [Optimize Code] is unchecked
    5. Click the [Advanced] button at the bottom of the Build tabpage
    6. Make sure that [Debug Info:] is set to [full]
    7. Click [OK] and rebuild the project ;-)
      (step 7 generates the .pdb files, these are the debugging symbols)

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.