WPF .NET 4 , workflow parameters and "Compiler error(s) encountered processing"
My workflow:
<Activity mc:Ignorable="sap" x:Class="QCISRApplication.QCISRTest1" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-namespace:QCISRApplication" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:s4="clr-namespace:System;assembly=System.ServiceModel" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sd1="clr-namespace:System.Data;assembly=System.Data.DataSetExtensions" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Members>
<x:Property Name="InputLine" Type="InArgument(sd:DataRow)" />
</x:Members>
<sap:VirtualizedContainerService.HintSize>772,961</sap:VirtualizedContainerService.HintSize>
<mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings>
<Flowchart sad:XamlDebuggerXmlReader.FileName="C:\PRJ\JD Powers\QCISR Tests Application\Main\Source\QC ISR\QCISRWorkbook2010\QCISRTest1.xaml" sap:VirtualizedContainerService.HintSize="732,921">
<Flowchart.Variables>
<Variable x:TypeArguments="x:Double" Name="Var1" />
<Variable x:TypeArguments="x:Double" Name="Var2" />
<Variable x:TypeArguments="x:Double" Name="PIN_Transaction_Count" />
</Flowchart.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">False</x:Boolean>
<av:Point x:Key="ShapeLocation">230,2.5</av:Point>
<av:Size x:Key="ShapeSize">60,75</av:Size>
<av:PointCollection x:Key="ConnectorLocation">260,77.5 260,107.5 260,145.5</av:PointCollection>
<x:Double x:Key="Width">718</x:Double>
<x:Double x:Key="Height">885</x:Double>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Flowchart.StartNode>
<FlowStep x:Name="__ReferenceID0">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">160,145.5</av:Point>
<av:Size x:Key="ShapeSize">200,49</av:Size>
<av:PointCollection x:Key="ConnectorLocation">260,194.5 260,224.5 255,224.5 255,282.5</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Sequence DisplayName="Read Values" sap:VirtualizedContainerService.HintSize="200,49">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign sap:VirtualizedContainerService.HintSize="242,57">
<Assign.To>
<OutArgument x:TypeArguments="x:Double">[Var1]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Double">67</InArgument>
</Assign.Value>
</Assign>
<Assign sap:VirtualizedContainerService.HintSize="242,57">
<Assign.To>
<OutArgument x:TypeArguments="x:Double">[Var2]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Double">90</InArgument>
</Assign.Value>
</Assign>
<Assign sap:VirtualizedContainerService.HintSize="242,57">
<Assign.To>
<OutArgument x:TypeArguments="x:Double">[PIN_Transaction_Count]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Double">3</InArgument>
</Assign.Value>
</Assign>
</Sequence>
<FlowStep.Next>
<FlowDecision x:Name="__ReferenceID1" Condition="[Var1 - Var2 < 0.1]" sap:VirtualizedContainerService.HintSize="60,75">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">210,282.5</av:Point>
<av:Size x:Key="ShapeSize">60,75</av:Size>
<av:PointCollection x:Key="FalseConnector">270,320 420,320 420,407.5</av:PointCollection>
<av:PointCollection x:Key="TrueConnector">210,320 120,320 120,412.5</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<FlowDecision.True&g开发者_开发技巧t;
<FlowDecision x:Name="__ReferenceID3" Condition="[PIN_Transaction_Count >= 3]" sap:VirtualizedContainerService.HintSize="60,75">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">90,412.5</av:Point>
<av:Size x:Key="ShapeSize">60,75</av:Size>
<av:PointCollection x:Key="FalseConnector">150,450 180,450 180,640 316,640</av:PointCollection>
<av:PointCollection x:Key="TrueConnector">90,450 80,450 80,677.5 110,677.5 110,707.5</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<FlowDecision.True>
<FlowStep x:Name="__ReferenceID5">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">6,707.5</av:Point>
<av:Size x:Key="ShapeSize">208,125</av:Size>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<InvokeMethod DisplayName="GreenLineSTATIC" sap:VirtualizedContainerService.HintSize="208,125" MethodName="DoGreenLine" TargetType="local:ResultsHightlighter" />
</FlowStep>
</FlowDecision.True>
<FlowDecision.False>
<FlowStep x:Name="__ReferenceID4">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">316,577.5</av:Point>
<av:Size x:Key="ShapeSize">208,125</av:Size>
<av:PointCollection x:Key="ConnectorLocation">380,597.5 380,567.5 190,567.5 190,597.5 130,597.5 130,567.5</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<InvokeMethod sap:VirtualizedContainerService.HintSize="208,125" MethodName="DoRedLine2" TargetType="local:ResultsHightlighter" />
</FlowStep>
</FlowDecision.False>
</FlowDecision>
</FlowDecision.True>
<FlowDecision.False>
<FlowStep x:Name="__ReferenceID2">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">316,407.5</av:Point>
<av:Size x:Key="ShapeSize">208,125</av:Size>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<InvokeMethod DisplayName="RedLine1STATIC" sap:VirtualizedContainerService.HintSize="208,125" MethodName="DoRedLine" TargetType="local:ResultsHightlighter" />
</FlowStep>
</FlowDecision.False>
</FlowDecision>
</FlowStep.Next>
</FlowStep>
</Flowchart.StartNode>
<x:Reference>__ReferenceID0</x:Reference>
<x:Reference>__ReferenceID1</x:Reference>
<x:Reference>__ReferenceID2</x:Reference>
<x:Reference>__ReferenceID3</x:Reference>
<x:Reference>__ReferenceID4</x:Reference>
<x:Reference>__ReferenceID5</x:Reference>
</Flowchart>
</Activity>
My C# code:
private void MainControl_OnProcess(object sender, RoutedEventArgs e)
{
QCISRTest1 qct = new QCISRTest1();
qct.Var1 = 3.6;
qct.Var2 = 35.7;
qct.PIN_Transaction_Count = 8;
Dictionary<string , object > res = new Dictionary<string,object> ( WorkflowInvoker.Invoke(qct));
}
Right at the moment I call WorkflowInvoker.Invoke I get the following exception:
A first chance exception of type 'System.Activities.ExpressionParser.SourceExpressionException' occurred in System.Activities.dll Additional information: Compiler error(s) encountered processing expression "PIN_Transaction_Count >= 3.0". 'PIN_Transaction_Count' is not declared. It may be inaccessible due to its protection level.
I wonder why I get this exception and how to avoid it?
精彩评论