I accidently discovered this yesterday and thought I’d share. If only this same technique worked with farm solutions…
If you’ve done any sandbox development you have probably had many moments when you pressed F5 to start debugging or done Build|Deploy only to see a failure because one of your feature receivers threw an error. To debug these problems in farm mode, you attach the debugger and then try to activate the feature via the site, PowerShell, or stsadm. It’s kind of a pain.
In sandbox mode, if you attach the debugger to the worker process manually before you deploy the solution you can catch and debug problems in your feature event receivers. To do so, select Debug|Attach to process and attach to SPUCWorkerProcess.exe.
Then, simply hit F5 or select Build|Deploy Solution. I wish I’d figured this out a year and a half ago. It would have saved me a great deal of time!
Author: Doug Ware