1
Vote

A bug or a special purpose

description

<p>Here is the StrategyChain.ExecuteTearDown implementation:</p> <p>&nbsp;</p> <p>public void ExecuteTearDown(IBuilderContext context)</p> <p> {</p> <p> Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(context, &quot;context&quot;);</p> <p>&nbsp;</p> <p> int i = 0;</p> <p>&nbsp;</p> <p> try</p> <p> {</p> <p> for (; i &lt; strategies.Count; ++i)</p> <p> {</p> <p> if (context.BuildComplete)</p> <p> {</p> <p> --i; // Skip current strategy&#39;s post</p> <p> break;</p> <p> }</p> <p> strategies[i].PreTearDown(context);</p> <p> }</p> <p>&nbsp;</p> <p> for (--i; i &gt;= 0; --i)</p> <p> {</p> <p> strategies[i].PostTearDown(context);</p> <p> }</p> <p> }</p> <p> catch(Exception)</p> <p> {</p> <p> context.RecoveryStack.ExecuteRecovery();</p> <p> throw;</p> <p> }</p> <p> }</p> <p>&nbsp;</p> <p>When the last BuilderStrategy in the chain set the context.BuildComplete to true, the ‘i’ doesn’t decrement, so the PostTearDown of the last BuilderStrategy also gets run.</p>

comments