Debugging InfoPath Browser form

To do this you need to ensure that the project properties on the infopath VSTA editor under Build > Advanced are set to full for debug.

Then after uploading, deploying, activating the form template as usual, copy the FormCode.cs file to your WFE. Open it in Visual Studio, attach to the correct w3wp worker process and debugging should work. Happy Days!