Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers 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!

share|improve this answer
    
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. –  LCountee Jun 12 '12 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. –  C. Marius - MVP Jun 12 '12 at 13:18
    
Thanks for your response. Can you clarify what un-registering events or cleaning event handlers means, so I can try that? –  LCountee Jun 12 '12 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 –  C. Marius - MVP Jun 12 '12 at 20:30
    
I used SharePoint Manager 2010 to check the Event Receivers for the list. Everything looked correct, no extra Event Receivers. –  LCountee Jun 13 '12 at 18:10
show 1 more comment

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.

share|improve this answer
    
Shouldn't there be a way to get this to work as a sandboxed solution? –  LCountee Jun 12 '12 at 12:56
    
I've now tried this as well. No luck. –  LCountee Jun 13 '12 at 20:09
    
Thanks it's worked when i Change the scope from "Web" to "Site" –  user9754 Jul 30 '12 at 18:41
add comment
up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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