<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>WF, WCF, and AppFabric notes</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:38:40 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Tracking an Expression activity in Windows Workflow Foundation</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/tracking-an-expression-activity-in-windows-workflow-foundation</link>
      <pubDate>Tue, 09 Aug 2011 10:44:29 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/08/09/tracking-an-expression-activity-in-windows-workflow-foundation/</guid>
      <description><![CDATA[Since the nodes in a Flowchart do not derive from Activity, they do not have the tracking...]]></description>
      <content:encoded><![CDATA[<p>Since the nodes in a Flowchart do not derive from Activity, they do not have the tracking capabilities of activities. However, because Expressions are activities, it is possible to track the Condition property of a FlowDecision activity.</p>
<p>The following code demonstrates how to create an Expression that can then participate in tracking.</p>
<p>&nbsp;</p>
<pre class="scroll"><code class="csharp">public class TrackResult&lt;T&gt; : CodeActivity&lt;T&gt;<br /> {<br /> public InArgument&lt;T&gt; Expression { get; set; }<br /> <br /> protected override T Execute(CodeActivityContext context)<br /> {<br /> T result = context.Get(Expression);<br /> // Either explicitly call context.Track here, or just set up a tracking profile on TrackResult.Expression<br /> return result;<br /> }<br /> }<br /> </code></pre>
<p></p>
<p>Note that in order to use a custom activity for the Condition property of a FlowDecision activity, the workflow must be created in code rather than using the designer. The following code snippet (from the <a href="https://msdn.microsoft.com/en-us/library/dd807383.aspx">Flowchart with Fault Handling</a> sample) demonstrates how to create a flowchart in code.</p>
<pre class="scroll"><code class="cplusplus">private static Activity CreateFlowchartWithFaults(string promoCode, int numKids)<br /> {<br /> Variable&lt;string&gt; promo = new Variable&lt;string&gt; { Default = promoCode };<br /> Variable&lt;int&gt; numberOfKids = new Variable&lt;int&gt; { Default = numKids };<br /> Variable&lt;double&gt; discount = new Variable&lt;double&gt;();<br /> DelegateInArgument&lt;DivideByZeroException&gt; ex = new DelegateInArgument&lt;DivideByZeroException&gt;();<br /> <br /> FlowStep discountNotApplied = new FlowStep<br /> {<br /> Action = new WriteLine <br /> { <br /> DisplayName = "WriteLine: Discount not applied", <br /> Text = "Discount not applied" <br /> },<br /> Next = null<br /> };<br /> <br /> FlowStep discountApplied = new FlowStep<br /> {<br /> Action = new WriteLine <br /> {<br /> DisplayName = "WriteLine: Discount applied",<br /> Text = "Discount applied " <br /> },<br /> Next = null<br /> };<br /> <br /> FlowDecision flowDecision = new FlowDecision <br /> {<br /> Condition = ExpressionServices.Convert&lt;bool&gt;((ctx) =&gt; discount.Get(ctx) &gt; 0),<br /> True = discountApplied,<br /> False = discountNotApplied<br /> };<br /> <br /> FlowStep singleStep = new FlowStep<br /> {<br /> Action = new Assign<br /> {<br /> DisplayName = "discount = 10.0",<br /> To = new OutArgument&lt;double&gt; (discount),<br /> Value = new InArgument&lt;double&gt; (10.0)<br /> },<br /> Next = flowDecision<br /> };<br /> <br /> FlowStep mnkStep = new FlowStep<br /> {<br /> Action = new Assign<br /> {<br /> DisplayName = "discount = 15.0",<br /> To = new OutArgument&lt;double&gt; (discount),<br /> Value = new InArgument&lt;double&gt; (15.0)<br /> },<br /> Next = flowDecision<br /> };<br /> <br /> FlowStep mwkStep = new FlowStep<br /> {<br /> Action = new TryCatch<br /> {<br /> DisplayName = "Try/Catch for Divide By Zero Exception",<br /> Try = new Assign<br /> {<br /> DisplayName = "discount = 15 + (1 - 1/numberOfKids)*10",<br /> To = new OutArgument&lt;double&gt;(discount),<br /> Value = new InArgument&lt;double&gt;((ctx) =&gt; (15 + (1 - 1 / numberOfKids.Get(ctx)) * 10))<br /> },<br /> Catches = <br /> {<br /> new Catch&lt;System.DivideByZeroException&gt;<br /> {<br /> Action = new ActivityAction&lt;System.DivideByZeroException&gt;<br /> {<br /> Argument = ex,<br /> DisplayName = "ActivityAction - DivideByZeroException",<br /> Handler =<br /> new Sequence<br /> {<br /> DisplayName = "Divide by Zero Exception Workflow",<br /> Activities =<br /> {<br /> new WriteLine() <br /> { <br /> DisplayName = "WriteLine: DivideByZeroException",<br /> Text = "DivideByZeroException: Promo code is MWK - but number of kids = 0" <br /> },<br /> new Assign&lt;double&gt;<br /> {<br /> DisplayName = "Exception - discount = 0", <br /> To = discount,<br /> Value = new InArgument&lt;double&gt;(0)<br /> }<br /> }<br /> }<br /> }<br /> }<br /> }<br /> },<br /> Next = flowDecision<br /> };<br /> <br /> FlowStep discountDefault = new FlowStep<br /> {<br /> Action = new Assign&lt;double&gt;<br /> {<br /> DisplayName = "Default discount assignment: discount = 0",<br /> To = discount,<br /> Value = new InArgument&lt;double&gt;(0)<br /> },<br /> Next = flowDecision<br /> };<br /> <br /> FlowSwitch&lt;string&gt; promoCodeSwitch = new FlowSwitch&lt;string&gt;<br /> {<br /> Expression = promo,<br /> Cases =<br /> {<br /> { "Single", singleStep },<br /> { "MNK", mnkStep },<br /> { "MWK", mwkStep }<br /> },<br /> Default = discountDefault<br /> };<br /> <br /> Flowchart flowChart = new Flowchart<br /> {<br /> DisplayName = "Promotional Discount Calculation",<br /> Variables = {discount, promo, numberOfKids},<br /> StartNode = promoCodeSwitch,<br /> Nodes = <br /> { <br /> promoCodeSwitch, <br /> singleStep, <br /> mnkStep, <br /> mwkStep, <br /> discountDefault, <br /> flowDecision, <br /> discountApplied, <br /> discountNotApplied<br /> }<br /> };<br /> return flowChart;<br /> }<br /> </code></pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Making an activity's display name readonly in the Workflow 4 designer</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/making-an-activitys-display-name-readonly-in-the-workflow-4-designer</link>
      <pubDate>Mon, 16 May 2011 09:41:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/05/16/making-an-activitys-display-name-readonly-in-the-workflow-4-designer/</guid>
      <description><![CDATA[To make an activity's display name readonly, it isn't enough to use the ReadOnlyAttribute on the...]]></description>
      <content:encoded><![CDATA[<p>To make an activity's display name readonly, it isn't enough to use the ReadOnlyAttribute on the DisplayName. In order to do this, create a custom PropertyValueEditor that displays a string in a text block, then declare an editor attribute on the "DisplayName" property of your activity. The following code demonstrates how to create a read-only custom PropertyValueEditor.</p>
<pre class="scroll"><code class="csharp">public class ReadOnlyStringEditor : PropertyValueEditor<br />
{<br />
    public ReadOnlyStringEditor()<br />
    {<br />
        FrameworkElementFactory factory = new FrameworkElementFactory(typeof(TextBlock));<br />
        factory.SetBinding(TextBlock.TextProperty, new Binding("Value"));<br />
        this.InlineEditorTemplate = new DataTemplate();<br />
        this.InlineEditorTemplate.VisualTree = factory;<br />
    }<br />
}</code></pre>
<p>&nbsp;</p>
<p>The following code demonstrates how to assign the custom property editor. This should be done in the constructor for the designer.\</p>
<pre class="scroll"><code class="csharp">// Add attribute onto MyCustomActivity.DisplayName<br />
AttributeTableBuilder builder = new AttributeTableBuilder();<br />
builder.AddCustomAttributes(typeof(Activity), "DisplayName", new EditorAttribute(typeof(ReadOnlyStringEditor), typeof(PropertyValueEditor)));<br />
MetadataStore.AddAttributeTable(builder.CreateTable());</code></pre>
<p>Finally, assign the display name in the custom activity's constructor.</p>
<p>﻿</p>
<pre class="scroll"><code class="csharp">this.DisplayName = "Custom Sequence Activity";</code></pre>]]></content:encoded>
    </item>
    <item>
      <title>Constraining what activities can be dropped on a custom activity designer in Workflow 4</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/constraining-what-activities-can-be-dropped-on-a-custom-activity-designer-in-workflow-4</link>
      <pubDate>Mon, 09 May 2011 15:33:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/05/09/constraining-what-activities-can-be-dropped-on-a-custom-activity-designer-in-workflow-4/</guid>
      <description><![CDATA[When designing a custom activity that can be used as a container for other activities, you may want...]]></description>
      <content:encoded><![CDATA[<p>When designing a custom activity that can be used as a container for other activities, you may want to restrict the activity user to a certain set of activities.</p>
<p>If the custom activity can only accept a single type, this can be implemented quite simply by setting the WorkflowItemPresenter.AllowedItemType or WorkflowItemsPresenter.AllowedItemType property. Here is an example of this:</p>
<p><code>&lt;sap:WorkflowItemsPresenter HintText="Drop Activities Here" <br />Margin="5" MinHeight="100"<br />Items="{Binding Path=ModelItem.Activities}"<br />AllowedItemType="{x:Type TypeName=sa:WriteLine}"&gt;</code></p>
<p>Note that to use the above code, you'll need to add a namespace declaration to your designer:</p>
<p><code>xmlns:sa="clr-namespace:System.Activities.Statements;assembly=System.Activities"</code></p>
<p>If you need to restrict to a set of allowed activity types, rather than a single type, this can be done by adding a validation error to the validation errors collection during the CacheMetadata phase. The following example shows how to create a validation error when an activity is added to the Activities collection that is not of type WriteLine or Assign:</p>
<p><code>protected override void CacheMetadata(NativeActivityMetadata metadata)<br />{<br />&nbsp;&nbsp;&nbsp; base.CacheMetadata(metadata);<br />&nbsp;&nbsp;&nbsp; foreach (Activity a in Activities)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((a.GetType() != typeof(System.Activities.Statements.WriteLine)) &amp;&amp; (a.GetType() != typeof(System.Activities.Statements.Assign)))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; metadata.AddValidationError("Child activity is not of type WriteLine or Assign");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; }<br />}</code></p>]]></content:encoded>
    </item>
    <item>
      <title>Programmatically calling validation in a rehosted Workflow 4 designer</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/programmatically-calling-validation-in-a-rehosted-workflow-4-designer</link>
      <pubDate>Wed, 27 Apr 2011 11:03:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/04/27/programmatically-calling-validation-in-a-rehosted-workflow-4-designer/</guid>
      <description><![CDATA[The workflow designer has a rich programming model that supports communication with the host. A...]]></description>
      <content:encoded><![CDATA[<p>The workflow designer has a rich programming model that supports communication with the host. A rehosted workflow designer will automatically validate a workflow when it is changed; in order to programmatically call validation on demand on a rehosted designer, use the following method:</p>
<p><code>designer.Context.Services.GetService&lt;ValidationSErvice&gt;().ValidateWorkflow();</code></p>
<p>To handle resulting validation errors, publish an implementation of IValidationErrorService, which will expose the set of errors through ValidationService.NavigateTo(). For information on how to do this, see the following topic:</p>
<p><a href="https://msdn.microsoft.com/en-us/library/ff521568.aspx">How to: Display Validation Errors in a Rehosted Designer</a></p>]]></content:encoded>
    </item>
    <item>
      <title>WF 4 hosting options: IIS, AppFabric, and Windows Service</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/wf-4-hosting-options-iis-appfabric-and-windows-service</link>
      <pubDate>Mon, 18 Apr 2011 12:23:50 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/04/18/wf-4-hosting-options-iis-appfabric-and-windows-service/</guid>
      <description><![CDATA[Most of the Windows Workflow Foundation samples use workflows that are hosted in a console...]]></description>
      <content:encoded><![CDATA[<p>Most of the Windows Workflow Foundation samples use workflows that are hosted in a console application, but this isn't a realistic scenario for real-world workflows. Workflows in actual business applications will be hosted in persistent processes- either a Windows service authored by the developer, or a server application such as IIS or AppFabric. The differences between these approaches are as follows.</p>
<h2>Hosting workflows in IIS with Windows AppFabric</h2>
<p>Using IIS with AppFabric is the preferred host for workflows. The host application for workflows using AppFabric is Windows Activation Service, which removes the dependency on HTTP over IIS alone. </p>
<h2>Hosting workflows in IIS</h2>
<p>Using IIS alone is not recommended, as there are management and monitoring tools available with AppFabric that facilitate maintenance of running applications. Workflows should only be hosted in IIS alone if there are infrastructure concerns with moving to AppFabric.</p>
<h2>Hosting a workflow in a custom Windows Service</h2>
<p>Creating a custom workflow service to host the workflow will require the developer to duplicate a lot of the functionality provided out-of-box by AppFabric, but will allow for more flexibility with custom functionality. This option should only be considered if AppFabric proves to not be an option.</p>]]></content:encoded>
    </item>
    <item>
      <title>HttpContext.Current returning null when using NetTcpBinding in WCF4</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/httpcontext-current-returning-null-when-using-nettcpbinding-in-wcf4</link>
      <pubDate>Wed, 06 Apr 2011 16:45:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/04/06/httpcontext-current-returning-null-when-using-nettcpbinding-in-wcf4/</guid>
      <description><![CDATA[When using NetTcpBinding, not all of the features of WCF are available, particularly those using...]]></description>
      <content:encoded><![CDATA[<p>When using NetTcpBinding, not all of the features of WCF are available, particularly those using HTTP. NetTcpBinding removes a dependency on HTTP (and IIS as a result, allowing the service to be hosted in WAS instead.)</p>
<p>HttpContext.Current is one of the features in WCF that is not available when using NetTcpBinding.</p>]]></content:encoded>
    </item>
    <item>
      <title>Error message in WF4: "Error: The values provided for the root activity's arguments did not satisfy the root activity's requirements"</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/error-message-in-wf4-error-the-values-provided-for-the-root-activitys-arguments-did-not-satisfy-the-root-activitys-requirements</link>
      <pubDate>Wed, 06 Apr 2011 16:33:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/04/06/error-message-in-wf4-error-the-values-provided-for-the-root-activitys-arguments-did-not-satisfy-the-root-activitys-requirements/</guid>
      <description><![CDATA[When loading an activity assembly using Assembly.LoadFrom, you may see the following error:
"Error:...]]></description>
      <content:encoded><![CDATA[<p>When loading an activity assembly using Assembly.LoadFrom, you may see the following error:</p>
<p class="MsoNormal" style="margin: 10pt 0in 0pt;"><span style="color: black;"><span style="font-size: small;"><span style="font-family: Calibri;">"Error: The values provided for the root activity's arguments did not satisfy the root activity's requirements: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'UserDefinedInputClass': Expected an input parameter value of type 'MyAssembly.UserDefinedClass' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for parameter named 'UDC'. Parameter name: rootArgumentValues"</span></span></span></p>
<p class="MsoNormal" style="margin: 10pt 0in 0pt;"><span style="color: black;"><span style="font-size: small;"><span style="font-family: Calibri;"><o:p>Assembly.LoadFrom does not use the main application context; instead, a new context is used, so type checking fails with the above error.</o:p></span></span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Workflow Designer: What properties appear in the Properties pane when activities are multi-selected?</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/workflow-designer-what-properties-appear-in-the-properties-pane-when-activities-are-multi-selected</link>
      <pubDate>Thu, 17 Mar 2011 12:09:13 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/03/17/workflow-designer-what-properties-appear-in-the-properties-pane-when-activities-are-multi-selected/</guid>
      <description><![CDATA[When multiple activities are selected in the Workflow Designer surface with ctrl+click, it's not...]]></description>
      <content:encoded><![CDATA[<p>When multiple activities are selected in the Workflow Designer surface with ctrl+click, it's not immediately obvious which properties appear in the Properties pane, and can be set on multiple activities at a time. When activites are multi-selected, the following properties appear in the Properties pane:</p>
<ul>
<li>Properties that have a common name across all the selected activities</li>
<li>Properties that are of type String or a value type.</li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Validation error message: "An error occurred while attempting to extract the target object of type 'System.Activites.InArgument' from the method call expression &lt;activity&gt;&lt;property&gt;.Get"</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/validation-error-message-an-error-occurred-while-attempting-to-extract-the-target-object-of-type-system-activites-inargument-from-the-method-call-expression-activityproperty-g</link>
      <pubDate>Wed, 16 Mar 2011 14:56:00 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/03/16/validation-error-message-an-error-occurred-while-attempting-to-extract-the-target-object-of-type-system-activites-inargument-from-the-method-call-expression-activityproperty-g/</guid>
      <description><![CDATA[When using the (non-Generic) version of InArgument, you may see the following error message during...]]></description>
      <content:encoded><![CDATA[<p>When using the (non-Generic) version of InArgument, you may see the following error message during validation:</p>
<p><span style="font-family: courier new,courier;">The private implementation of activity '&lt;activity&gt;' has the following validation error: "An error occurred while attempting to extract the target object of type 'System.Activites.InArgument' from the method call expression &lt;activity&gt;&lt;property&gt;.Get". Note that the expression determining the object of type 'System.Activities.InArgument' must not require the runtime context.<br />Error: The sub-expression for the object of type 'System.Activities.InArgument' resulted in a location reference that is not visible at this scope.</span></p>
<p>The cause for this error is that the default reflection logic that happens during CacheMetadata to tell the runtime about the signature of an activity only looks for arguments with generic types. </p>
<p>Two solutions for this problem are:</p>
<ul>
<li>Use the generic version of InArgument with the anticipated type</li>
<li>Override CacheMetadata and add the InArgument to the activity signature explicitly, as in the following code snippet:</li>
</ul>
<p><span style="font-family: courier new,courier;">protected override void CacheMetadata(ActivityMetadata metadata)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;base.CacheMetadata(metadata);<br />&nbsp;&nbsp;&nbsp;&nbsp;this.myValue = MyValue ?? new InArgument&lt;object&gt;();<br />&nbsp;&nbsp;&nbsp;&nbsp;RuntimeArgument arg = new RuntimeArgument("MyValue", this.myValue.ArgumentType, ArgumentDirection.In);<br />&nbsp;&nbsp;&nbsp;&nbsp;metadata.AddArgument(arg);<br />&nbsp;&nbsp;&nbsp;&nbsp;metadata.Bind(this.myValue, arg);<br />}</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Cancelling an AsyncCodeActivity</title>
      <link>https://docs.microsoft.com/archive/blogs/wf_wcf_and_appfabric_notes/cancelling-an-asynccodeactivity</link>
      <pubDate>Wed, 16 Mar 2011 12:15:52 GMT</pubDate>
      <dc:creator><![CDATA[Patrick D. Fletcher [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wf_wcf_and_appfabric_notes/2011/03/16/cancelling-an-asynccodeactivity/</guid>
      <description><![CDATA[Even when AsyncCodeActivity.Cancel is called, the activity will still execute the EndExecute method,...]]></description>
      <content:encoded><![CDATA[<p>Even when AsyncCodeActivity.Cancel is called, the activity will still execute the EndExecute method, so it isn't immediately obvious why a second path of execution is necessary. Implementing this method is useful only when AsyncCodeActivityContext.MarkCanceled is implemented, which in turn is useful mainly when cancellation is meaningful for the underlying operation (i.e. if work already completed can be rolled back).</p>
<p>In order to implement cancellation in a useful way, do the following:</p>
<ul>
<li>Call AsyncCodeActivityContext.MarkCanceled to mark the activity as canceled.</li>
<li>In the Cancel method, check to see what work had already been done by the activity, and undo the work.</li>
<li>Do not duplicate effort in the Cancel and the EndExecute methods in case of cancellation, since both methods will be called.</li>
</ul>
<p>If no work needs to be rolled back when an AsyncCodeActivity is canceled, it is not necessary to override AsyncCodeActivity.Cancel.</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>