CreateWorkflow failing validation

I am trying to start a workflow using a xoml file. I am getting Workflow failed validation in CreateWorkflow with a very simple workflow containing start, delay 1 sec and stop. Is there a trick in getting this to work? Thanks.

// create and start an instance of the workflow runtime

WorkflowRuntime runtime =newWorkflowRuntime();

runtime.StartRuntime();

// get an XML reader to the XAML-based workflow definition

System.Xml.XmlReader xaml = System.Xml.XmlTextReader.Create(txtWorkflowFile.Text);

// create a running instance of our workflow

WorkflowInstance instance;

try

{

instance = runtime.CreateWorkflow(xaml);

instance.Start();

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

[1558 byte] By [SoheilSaadat] at [2007-12-21]
# 1
We really need to see the XAML. And the error message.
JonFlanders at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

Jon,

Here is the XOML file. If we strip the x:Class="WorkflowDesignerControl.CustomWorkflow" from the Xoml then we execute fine.

<?xml version="1.0" encoding="utf-8"?>
<SequentialWorkflowActivity x:Name="CustomWorkflow" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow" x:Class="WorkflowDesignerControl.CustomWorkflow">
<DelayActivity TimeoutDuration="00:00:05" x:Name="Sleep" />
</SequentialWorkflowActivity>

error 1564: x:calss cannot be used when the markup is executed directlywithout creating a new activity type.

I also saw some code that talked about serilizing and deserilizing the XOML...

Thanks.

SoheilSaadat at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3

Right - there are two kind of XAML.

Executable XAML - this is XAML where you can get back an Activity Tree from calling WorkflowRuntime.CreateWorkflow.

Compilable XAML - this XAML that can be compiled into a new Activity type (either in VS.NET, via the WFC tool or WorkflowCompiler class).

Executable XAML cannot have the Class attribute. Compilable XAML *must* have the Class attribute. Executable XAML cannot have any inline code, compilable XAML can. There are of course other differences as well - but those are the main two.

JonFlanders at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4

Thank you for the clarification.

Here is the problem:

1. The designer creates a XOML with x:Class

2. We can strip this out and create a new XOML and get it to execute

3. But the Workflow monitor then complains because it uses the designer and the XOML stored at run time is missing the X:Class and this we do not have control over.

Thoughts?

SoheilSaadat at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5

Hi Soheil,

I am running into the same problem and was worndring if you got answers to your questions?

How did you solve the issue?

Thanks

Sonali

ksona at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified