Looks like I made a pretty big mistake when doing some testing with a sample sharepoint project. Ironically, I was trying to spike up a unit testable solution, without writing many of the tests first. I am still pretty new to SharePoint, and wanted to explore what I can / can't do with SP and IoC.
So without going into too much detail, I accidentally wrote some code that is recursive and ends up throwing a StackOverflowException. Not a big deal, right? Just retract the solution and remove it. The problem is that this code gets called during a solution feature's
FeatureUninstalling method in a
(Well, not exactly. The code ends up getting called during the
SPFeatureReceiver's static constructor. If you're wondering why, I was trying to compose the root using Castle Windsor in order to inject dependencies that can be used during the FeatureInstalling and FeatureUninstalling methods.)
So what happens when trying to use either the central web admin or Uninstall-SPSolution is:
- A job is scheduled to retract the solution.
- The job executes and tries to retract the solution.
- The job constructs a new SPFeatureReceiver in order to invoke FeatureUninstalling.
- The SPFeatureReceiver (static) constructor invokes code that will try to compose the root, and within there, ends up throwing a StackOverflowException.
- I receive a popup message indicating that OWSTIMER.exe encountered an exception, and asks if I want to debug.
- OWSTIMER.exe restarts and loops back to step #2.
Hence the question: How to retract an unretractable solution?