Hello,
I am hosting the WF designer (beta 2) as shown in the WorkflowDesignerControl sample. The only difference is that I don't use the property grid for setting activity properties.
When I select the IfElseBranchActivity and I try to run the RunConditionDialog for creating the condition rule, I do as following:
public RuleExpressionCondition NewCondition(Activity activity, string coditionName)
{
RuleExpressionCondition condition = new RuleExpressionCondition(coditionName);
RuleConditionDialog dlg = new RuleConditionDialog(activity, condition.Expression);
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
condition.Expression = dlg.Expression;
return condition;
}
else
return null;
}
executing the above code I get an exception on the RuleConditionDialog constructor:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="System.Workflow.Activities"
StackTrace:
at System.Workflow.Activities.Rules.Parser..ctor(RuleValidation validation)
at System.Workflow.Activities.Rules.Design.RuleConditionDialog..ctor(Activity activity, CodeExpression expression)
at HOPES.Security.Workflow.Rules.NewCondition(Activity activity, String coditionName) in D:\Code\MyDemoDesigner\Workflow\Rules.cs:line 64
at HOPES.Security.Workflow.SelectConditionDialog.NewCondition() in D:\Code\MyDemoDesigner\Workflow\SelectConditionDialog.cs:line 83
at HOPES.Security.Workflow.SelectConditionDialog.actionButtonEdit_ButtonClick(Object sender, ButtonPressedEventArgs e) in D:\Code\MyDemoDesigner\Workflow\SelectConditionDialog.cs:line 58
at DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit.RaiseButtonClick(ButtonPressedEventArgs e)
at DevExpress.XtraEditors.ButtonEdit.OnClickButton(EditorButtonObjectInfoArgs buttonInfo)
at DevExpress.XtraEditors.ButtonEdit.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.XtraEditors.BaseControl.WndProc(Message& m)
at DevExpress.XtraEditors.TextEdit.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at HOPES.Security.Workflow.ConditionPropertyControl.conditionButtonEdit_Click(Object sender, EventArgs e) in D:\Code\MyDemoDesigner\Workflow\PropertyControls\ConditionPropertyControl.cs:line 34
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.XtraEditors.BaseControl.WndProc(Message& m)
at DevExpress.XtraEditors.TextEdit.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at HOPES.DevEnv.Program.Main() in D:\Code\VisualStudioSecurity\VisualStudioSecurityDeveloperEnvironment\Program.cs:line 47
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Any idea
Thanks,
Pierre

Create new condition rule from the designer
ngc
Trevor Hancock MSFT
Hi Pierre,
I and Vihang tried out your scenario. We could repro it on the Beta 2 build, however this has been fixed on later builds.
Thanks,
Chethan