1

I'm trying to debug an ItemUpdated event receiver in SharePoint 2010. I add breakpoints to the code, and hit F5 in Visual Studio 2010. I click Attach when I'm prompted to attach to the process. Then, I enable the feature and update my list item. I receive the error message: "The breakpoint will not currently be hit. No symbols have been loaded for this document."

I've looked at a lot of posts online, and they all seem to have different suggestions. Here is what I have tried so far:

  • manually set event handler to "synchronous" in Elements.xml
  • disabled "just my code"
  • set "active deployment configuration" to "no activation"
  • sacrificed to the development gods (OK not yet, but possibly soon)

None of the above have worked. What else can I try?

4 Answers 4

3

Just to be clear - you want to debug an already deployed Sandboxed solution, you need to attach the SPUCWorkerProcess.exe proccess manually and hit F5 to debug!

Occasionally a VS restart helps as well as a good old stop/start of the Sandbox Service via SharePoint CA!

6
  • The sandboxed solution is not in production - just testing. Do I still need to attach to the spucworkerprocess.exe manually? It seems that Visual Studio automatically has me attach to a different process? I've restarted VS several times since this problem started, and took your suggestion to restart the sandbox service, but no luck.
    – LFurness
    Jun 12, 2012 at 12:54
  • Assuming you run locally SharePoint :) and VS (administrator mode, right?), usually VS does it automatically! But if it doesn't work it could mean that there is another Event probably registered and not properly UN-registered, which picks the call. Make sure you CLEAN all handlers already attached and try again. I do not believe deploying as Farm solution would NOT help as you will be running on the same issue with stalled Receivers. Jun 12, 2012 at 13:18
  • Thanks for your response. Can you clarify what un-registering events or cleaning event handlers means, so I can try that?
    – LFurness
    Jun 12, 2012 at 20:24
  • If you register Event Handlers with a list/content type you should also un-register them upon feature deactivation, because if you just keep on queuing up so one-by-one they actually respond to events - which also causes a lot of confusion sometimes - have a look at this tool speventhandlermanage.codeplex.com/releases/view/44644or simply use SharePoint Manager 2010 - also on CodePlex free to look Jun 12, 2012 at 20:30
  • I used SharePoint Manager 2010 to check the Event Receivers for the list. Everything looked correct, no extra Event Receivers.
    – LFurness
    Jun 13, 2012 at 18:10
1

Try the following:

  1. Deploy the solution as Farm solution
  2. Change the scope as "Site" from "Web"
  3. Rebuild the solution file and deploy it agagin.
  4. Finally press F5 and put the break point in the code where you want.

Please let me know if the above doesn't work.

3
  • Shouldn't there be a way to get this to work as a sandboxed solution?
    – LFurness
    Jun 12, 2012 at 12:56
  • I've now tried this as well. No luck.
    – LFurness
    Jun 13, 2012 at 20:09
  • Thanks it's worked when i Change the scope from "Web" to "Site"
    – user9754
    Jul 30, 2012 at 18:41
1

Senthil's and C. Marius's answers both helped, so I voted them up. Thanks again for your help and patience.

Here is how this was resolved:

  • removed all workflows for the forms library in question
  • in SharePoint Manager 2010, deleted all event receivers for the forms library, except for the Document ID Generators, which are related to the InfoPath form itself
  • restarted server (single server farm) (IIS reset and sandbox service restart might also have been enough)
  • When I removed the code that used SPUserToken, I was able to hit the breakpoints. Found that SPUserToken is apparently not available in sandboxed event handlers, so I did have to deploy to the GAC.

After that, I was able to re-add the workflows and everything worked properly. Learned a lot about event handler debugging.

0

I had two issues that were stopping me from debugging, so perhaps this will help someone:

First, I wasn't hitting any breakpoints. For my solution, every time I deployed it, was disabling the feature. All of the experienced SP devs here had no idea why that was happening, but it was. When I figure out how to stop that, I'll amend this answer. But for now, when I deploy the solution, I have to go to the "Site Features" page (in 2013, Gear> Site Settings > "Manage Site Features" (under Site Actions), scroll down to find my app's feature and click "Activate." Every. Single. Time. grrr

Then, I was hitting some breakpoints but not others. Most infuriatingly, I would hit "ItemUpdating" but not "ItemUpdated." The breakthrough here came when I discovered that by commenting out all my code, I could get the event to fire. What I discovered was I was using a 3rd party dll that had not been deployed to the GAC. Why ShartPoint doesn't load the event handler and just throw an assembly not found error like Every. Other. Platform. I've. Ever. Used. I'll never know. But that was it, once I got that installed, I was at least able to debug my event receiver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.