@aktau You're touching on another topic I wanted to bring up, but haven't had the cycles to do.  I used to hack on Subversion some time ago, which had/has a fair number of asserts in the code base.  The TortoiseSVN maintainer at the time, Stefan Küng (who does absolutely amazing work, BTW), made a fair point.  He basically said anywhere that the code was trying to be a library (which is most of the Subversion code base), you should really avoid asserting as much as possible.  The idea being that you don't always understand the environment you're running in, and assertions could be damaging.  In his case, whenever Subversion asserted, it was would cause Explorer to die a horrible death.

Don't get me wrong, I think assertions have their place, but Stefan's view has stuck in my mind ever since, especially because integration with Explorer was such an interesting use-case.  It's probably worth keeping in mind.

All that said, it's probably hard to wiggle out of this function in a meaningful way and report an error without dying.