SharePoint logger bug workaround
So yesterday I blogged about a bug in the SharePoint tracelog code, which would result in a ridiculous and unnecessary exception, should you happen to create a site collection, with feature file deployment, from a WCF service. If you haven't read that - feel free to do that now: 'Tis a SharePoint bug, it is!
Anyhoo, after giving up on having it fixed by the powers that be anytime soon, and not wanting to be too intrusive (ie. patching standard code, or injecting a hotfix at runtime), I went with a much more ... logical ... solution.
Allow me to demonstrate.
While this approach from yesterday didn't work:
Click it to view larger version.
This most certainly does:

In layman's terms: In the WCF service I now - rather than create the site coll directly - 1. Create a new thread, which creates the site coll, 2. Wait for the thread to end, and 3. Return. Makes perfect sense (actually it does). The stack rewind done in the trace api will stop at the entry into the worker thread, and thus never get to the DynamicMethod in WCF, which breaks it all apart.
Time for coffee.

0 comments:
Post a Comment