Windows Workflow Foundation 3


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 = new WorkflowRuntime();
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);
}
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.
We really need to see the XAML.  And the error message.
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.
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.
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?
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

Related Links

front end
Dynamic Workflow Creation
ApplyworkflowChanges takes long time and some time crashes the application.
CLR20r3 Error when i run exe file (C#)
Process is terminated due to StackOverflowException
HandleExternalEvent: event filter / correlation
SqlTrackingService & User Events
How to change the sendemail activity property at run time?
Question on Queue Management
Load rules in the Designer Rehosting demo
IExtendedUIService must be installed
Does WF support transactions?
After wf receives external event, the host never sees any more tracking events
How to implement Unit test in a Sequential workflow
data exchange between workflow activities
While() activity a cpu hog

Categories

MSDN
SQL Server (Pre-release)
Samsung PC
Bing Maps
Other Forums
Microsoft Azure
In-App Advertising (Ad...
Windows Phone Preview ...
OneDrive Development
Virtualization
Visual C++
Visual F#
Windows App Studio Beta
Promote Your App
App & Ad Unit Management
XboxLiveDevelopment
Windows Desktop SDK
Windows Hardware WDK a...
Message Analyzer
SharePoint 2013 - Usin...
SharePoint 2010 - Gene...
Azure Management Portal
Azure Media Services
Azure Pack
Azure Logic Apps
Azure Data Catalog
Azure Functions
Azure Database for Pos...
Azure Database for MySQL
Windows Workflow Found...
BizTalk Server EDI and...
BizTalk ESB Toolkit
Reactive Extensions (Rx)
Microsoft Translator H...
Small Basic
Microsoft Robotics - C...
Microsoft Robotics - H...
Visual Studio Smart De...
SQL Server Analysis Se...
SQL Server Setup & Upg...
SQL Server Data Tools
SQL Server In-Memory T...
Standard 7: Components...
Windows Embedded Compa...
SQL Server 2012 Setup ...
SQL Server 2012 High A...
SQL Server 2012 SQL To...
Windows Forms Designer
CRM
Speech Service for Dev...
WebsitePanel - Support
Bing Maps REST, SOAP, ...
Visio General Question...
Microsoft Unified Comm...
Programming Silverligh...
Silverlight Controls a...
Visual Studio & Silver...
Accessing Web Services...
Connected Services Fra...
Project Standard and P...
ADO.NET Entity Framewo...
Dynamic Languages on .NET
Game Technologies: Aud...
Game Technologies: Dir...
LightSwitch in Visual ...
Microsoft "Data Explor...
Popfly Explorer
Search Server: Federation
Sharepoint Development...
SQL Server 2014 In Azu...
SQL Server 2014 Integr...
Team Foundation Server...
Team Foundation Server...
Tellme Studio (retired)
Transactions Programming
Visual Basic Express E...
Visual Basic for Appli...
Visual C# 2008 (Pre-re...
Visual C# Express 2008...
Visual C# IDE
Visual C++ Express Edi...
Visual Studio Async CTP
Visual Studio 2008 (Pr...
Visual Studio Gallery ...
Web Sandbox - General
Windows CardSpace ('In...
Building Windows Store...
XML in Windows (MSXML ...
Microsoft R Server

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile