Skip to content

Instantly share code, notes, and snippets.

@bradbrowne
Last active March 3, 2017 01:45
Show Gist options
  • Save bradbrowne/7fa1e6bf127f6bd0812da8a1ccb074f6 to your computer and use it in GitHub Desktop.
Save bradbrowne/7fa1e6bf127f6bd0812da8a1ccb074f6 to your computer and use it in GitHub Desktop.
πŸ› GeoCortex FilePicker uploads file multiple times if FileItem properties are accessed multiple times.
<Activity mc:Ignorable="sap sap2010 sads" x:Class="ActivityBuilder" this:ActivityBuilder.WorkflowContainerName="FileUploadIssue"
xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
xmlns:eac="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
xmlns:eacg="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client"
xmlns:eact="clr-namespace:ESRI.ArcGIS.Client.Tasks;assembly=ESRI.ArcGIS.Client"
xmlns:gce="clr-namespace:Geocortex.Core.Extensions;assembly=Geocortex.Core"
xmlns:gcx="http://apis.geocortex.com/2009"
xmlns:gfc="clr-namespace:Geocortex.Forms.Client;assembly=Geocortex.EssentialsWpfApi"
xmlns:gfci="clr-namespace:Geocortex.Forms.Client.Items;assembly=Geocortex.EssentialsWpfApi"
xmlns:gr="clr-namespace:Geocortex.Reporting;assembly=Geocortex.Reporting"
xmlns:gwa="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow"
xmlns:gwa1="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow.Activities"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
xmlns:s="clr-namespace:System;assembly=System.Core"
xmlns:s1="clr-namespace:System;assembly=System"
xmlns:s2="clr-namespace:System;assembly=mscorlib"
xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities"
xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
xmlns:sl="clr-namespace:System.Linq;assembly=System.Core"
xmlns:this="clr-namespace:"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Members>
<x:Property Name="WorkflowContainerName" Type="InArgument(x:String)" />
</x:Members>
<mva:VisualBasic.Settings>
<x:Null />
</mva:VisualBasic.Settings>
<sap2010:WorkflowViewState.IdRef>ActivityBuilder_1</sap2010:WorkflowViewState.IdRef>
<TextExpression.NamespacesForImplementation>
<sco:Collection x:TypeArguments="x:String">
<x:String>System.Activities.XamlIntegration</x:String>
<x:String>System.Activities.Validation</x:String>
<x:String>System.Activities</x:String>
<x:String>System.Activities.Statements</x:String>
<x:String>System.Activities.Expressions</x:String>
<x:String>ESRI.ArcGIS.Client</x:String>
<x:String>ESRI.ArcGIS.Client.Geometry</x:String>
<x:String>ESRI.ArcGIS.Client.Tasks</x:String>
<x:String>Geocortex.Core.Extensions</x:String>
<x:String>Geocortex.Workflow.Activities</x:String>
<x:String>Geocortex.Forms.Client</x:String>
<x:String>Geocortex.Forms.Client.Items</x:String>
<x:String>Geocortex.Reporting</x:String>
<x:String>System</x:String>
<x:String>Microsoft.VisualBasic.Activities</x:String>
<x:String>System.Collections.Generic</x:String>
<x:String>System.Linq</x:String>
<x:String>System.Windows.Markup</x:String>
</sco:Collection>
</TextExpression.NamespacesForImplementation>
<TextExpression.ReferencesForImplementation>
<sco:Collection x:TypeArguments="AssemblyReference">
<AssemblyReference>System.Activities</AssemblyReference>
<AssemblyReference>ESRI.ArcGIS.Client</AssemblyReference>
<AssemblyReference>Geocortex.Core</AssemblyReference>
<AssemblyReference>Geocortex.Workflow</AssemblyReference>
<AssemblyReference>Geocortex.EssentialsWpfApi</AssemblyReference>
<AssemblyReference>Geocortex.Reporting</AssemblyReference>
<AssemblyReference>System.Core</AssemblyReference>
<AssemblyReference>System</AssemblyReference>
<AssemblyReference>mscorlib</AssemblyReference>
<AssemblyReference>PresentationFramework</AssemblyReference>
<AssemblyReference>WindowsBase</AssemblyReference>
<AssemblyReference>PresentationCore</AssemblyReference>
<AssemblyReference>System.Xaml</AssemblyReference>
<AssemblyReference>System.ComponentModel.Composition</AssemblyReference>
<AssemblyReference>System.ServiceModel</AssemblyReference>
<AssemblyReference>System.Reactive.Core</AssemblyReference>
</sco:Collection>
</TextExpression.ReferencesForImplementation>
<Sequence DisplayName="Main" sap2010:WorkflowViewState.IdRef="Sequence_2" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
<Sequence.Variables>
<Variable x:TypeArguments="scg:Dictionary(x:String, x:Object)" Name="formResult" />
<Variable x:TypeArguments="scg:IList(gcx:FileItem)" Name="attachments" />
<Variable x:TypeArguments="gcx:FileItem" Name="fileItem" />
</Sequence.Variables>
<gwa1:DisplayForm FormDefinition="&lt;FormDefinition xmlns=&quot;http://schemas.datacontract.org/2004/07/Geocortex.Forms.Client&quot; xmlns:i=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;&lt;ContainerFormItem xmlns:a=&quot;http://schemas.datacontract.org/2004/07/Geocortex.Forms.Client.Items&quot;&gt;&lt;a:ArgumentName/&gt;&lt;a:IsVisible&gt;true&lt;/a:IsVisible&gt;&lt;a:ItemID&gt;Group1&lt;/a:ItemID&gt;&lt;a:ToolTip/&gt;&lt;a:ValidationItems xmlns:b=&quot;http://schemas.datacontract.org/2004/07/Geocortex.Forms.Client.Items.Validation&quot;/&gt;&lt;a:Description/&gt;&lt;a:FormItems&gt;&lt;a:FormItem i:type=&quot;a:FilePickerFormItem&quot;&gt;&lt;a:ArgumentName&gt;ATTACHMENTS&lt;/a:ArgumentName&gt;&lt;a:IsVisible&gt;true&lt;/a:IsVisible&gt;&lt;a:ItemID&gt;FilePicker1&lt;/a:ItemID&gt;&lt;a:ToolTip/&gt;&lt;a:ValidationItems xmlns:b=&quot;http://schemas.datacontract.org/2004/07/Geocortex.Forms.Client.Items.Validation&quot;&gt;&lt;b:ValidationItem i:type=&quot;b:FileSizeValidationItem&quot;&gt;&lt;b:Message&gt;2GB total file size limit exceeded&lt;/b:Message&gt;&lt;b:TotalFileSize&gt;2147483647&lt;/b:TotalFileSize&gt;&lt;/b:ValidationItem&gt;&lt;/a:ValidationItems&gt;&lt;a:AcceptFileTypes i:nil=&quot;true&quot;/&gt;&lt;a:AllowMultiple&gt;true&lt;/a:AllowMultiple&gt;&lt;a:Label&gt;&lt;a:ArgumentName/&gt;&lt;a:IsVisible&gt;true&lt;/a:IsVisible&gt;&lt;a:ItemID/&gt;&lt;a:ToolTip/&gt;&lt;a:ValidationItems xmlns:b=&quot;http://schemas.datacontract.org/2004/07/Geocortex.Forms.Client.Items.Validation&quot;/&gt;&lt;a:LabelForItemID/&gt;&lt;a:Text&gt;FilePicker1&lt;/a:Text&gt;&lt;/a:Label&gt;&lt;/a:FormItem&gt;&lt;/a:FormItems&gt;&lt;a:MaxWidth&gt;INF&lt;/a:MaxWidth&gt;&lt;a:Orientation&gt;Vertical&lt;/a:Orientation&gt;&lt;a:VisibleControlID i:nil=&quot;true&quot;/&gt;&lt;a:VisibleControlValue i:nil=&quot;true&quot;/&gt;&lt;/ContainerFormItem&gt;&lt;KnownTypes xmlns:a=&quot;http://schemas.microsoft.com/2003/10/Serialization/Arrays&quot;&gt;&lt;a:string&gt;Geocortex.Forms.Client.Items.ContainerFormItem&lt;/a:string&gt;&lt;a:string&gt;Geocortex.Forms.Client.Items.FilePickerFormItem&lt;/a:string&gt;&lt;a:string&gt;Geocortex.Forms.Client.Items.Validation.FileSizeValidationItem&lt;/a:string&gt;&lt;/KnownTypes&gt;&lt;MaxHeight&gt;800&lt;/MaxHeight&gt;&lt;MaxWidth&gt;1000&lt;/MaxWidth&gt;&lt;Title&gt;Form Title&lt;/Title&gt;&lt;Version&gt;1.1&lt;/Version&gt;&lt;/FormDefinition&gt;" FormResults="[formResult]" sap2010:WorkflowViewState.IdRef="DisplayForm_1" WorkflowContainerName="[WorkflowContainerName]">
<gwa1:DisplayForm.Body>
<ActivityAction x:TypeArguments="gcx:FormDefinition">
<ActivityAction.Argument>
<DelegateInArgument x:TypeArguments="gcx:FormDefinition" Name="form" />
</ActivityAction.Argument>
<Sequence DisplayName="RuntimeModifications" sap2010:WorkflowViewState.IdRef="Sequence_1" />
</ActivityAction>
</gwa1:DisplayForm.Body>
<gwa1:DisplayForm.Buttons>
<gcx:FormButton CausesValidation="True" IsDefault="True" Label="Upload" Value="Upload" />
</gwa1:DisplayForm.Buttons>
<gwa1:DisplayForm.FormOutArguments>
<gwa:ArgumentWrapper x:TypeArguments="OutArgument" IsRequired="False" Name="ATTACHMENTS">
<gwa:ArgumentWrapper.Argument>
<OutArgument x:TypeArguments="scg:IList(gcx:FileItem)">[attachments]</OutArgument>
</gwa:ArgumentWrapper.Argument>
</gwa:ArgumentWrapper>
</gwa1:DisplayForm.FormOutArguments>
</gwa1:DisplayForm>
<gwa1:ServerScope sap2010:WorkflowViewState.IdRef="ServerScope_1">
<gwa1:ServerScope.Body>
<ActivityAction>
<Assign DisplayName="attachments Assign" sap2010:WorkflowViewState.IdRef="Assign_2">
<Assign.To>
<OutArgument x:TypeArguments="gcx:FileItem">[fileItem]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="gcx:FileItem">[attachments.First]</InArgument>
</Assign.Value>
</Assign>
</ActivityAction>
</gwa1:ServerScope.Body>
</gwa1:ServerScope>
<gwa1:ExternalLog sap2010:WorkflowViewState.IdRef="ExternalLog_1" Message="[fileItem.FileName]" />
<gwa1:ExternalLog sap2010:WorkflowViewState.IdRef="ExternalLog_2" Message="[fileItem.FileName]" />
<sads:DebugSymbol.Symbol>d44BQzpcUHJvZ3JhbSBGaWxlcyAoeDg2KVxMYXRpdHVkZSBHZW9ncmFwaGljc1xHZW9jb3J0ZXggRXNzZW50aWFsc1xHWDQ2MlxSRVNUIEVsZW1lbnRzXFNpdGVzXFRlbXBsYXRlc1xXb3JrZmxvd3NcQXNzZXRcR2lzdFxGaWxlVXBsb2FkSXNzdWUueGFtbBABcAGAAQECTAN3DgIBAVIFZRgCAQtmBXMYAgEGdAV0ZwIBBHUFdWcCAQJSJlLyEgIBElLUE1LtEwIBEGFEYVECAQ9S/xJSjRMCAQ1YC1hnAgEMaQtwFAIBB3RPdGQCAQV1T3VkAgEDbjpuTQIBCms7a0UCAQg=</sads:DebugSymbol.Symbol>
</Sequence>
<sap2010:WorkflowViewState.ViewStateManager>
<sap2010:ViewStateManager>
<sap2010:ViewStateData Id="Sequence_1" sap:VirtualizedContainerService.HintSize="200,97">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="DisplayForm_1" sap:VirtualizedContainerService.HintSize="297,540" />
<sap2010:ViewStateData Id="Assign_2" sap:VirtualizedContainerService.HintSize="242,59" />
<sap2010:ViewStateData Id="ServerScope_1" sap:VirtualizedContainerService.HintSize="297,135" />
<sap2010:ViewStateData Id="ExternalLog_1" sap:VirtualizedContainerService.HintSize="297,59" />
<sap2010:ViewStateData Id="ExternalLog_2" sap:VirtualizedContainerService.HintSize="297,59" />
<sap2010:ViewStateData Id="Sequence_2" sap:VirtualizedContainerService.HintSize="319,1037">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="ActivityBuilder_1" sap:VirtualizedContainerService.HintSize="359,1117" />
</sap2010:ViewStateManager>
</sap2010:WorkflowViewState.ViewStateManager>
</Activity>
@bradbrowne
Copy link
Author

The file is uploaded twice as can be seen in Chrome Developer Tools below:

chromedevelopertoolsfileuploadtwice

This is caused by the FileItem.FileName being externally logged twice:

fileitem_filename

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment