Note that there are some explanatory texts on larger screens.

plurals
  1. POWorkflowInspectionServices throw me an XamlObjectWriterException in Workflow Foundation
    primarykey
    data
    text
    <p>For a simple prototype, I've to display a workflow file, and show on which step we are actually.</p> <p>I found a sample here: <a href="http://msdn.microsoft.com/en-us/library/ee624139.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ee624139.aspx</a></p> <p>Which does almost what I need.</p> <p>In this sample, all action never wait on another action. So I created myself some very dummy Activity:</p> <pre><code> public class WaitForNextCall :NativeActivity { public const String WaitBookmark = "WaitingStep"; #region Overrides of NativeActivity /// &lt;summary&gt; /// When implemented in a derived class, runs the activity’s execution logic. /// &lt;/summary&gt; /// &lt;param name="context"&gt;The execution context in which the activity executes.&lt;/param&gt; protected override void Execute(NativeActivityContext context) { context.CreateBookmark(WaitBookmark); } protected override bool CanInduceIdle { get { return true; } } #endregion } </code></pre> <p>Which seems to work. Since there I was creating my workflow directly in-code:</p> <pre><code> return new Sequence() { Activities = { new WaitForNextCall(){DisplayName = "Step one"}, new WaitForNextCall(){DisplayName = "Step Two"}, new WaitForNextCall(){DisplayName = "Step Three"}, new WaitForNextCall(){DisplayName = "Step Four"} } }; </code></pre> <p>The only problem with that is that I only see a "Sequence" element in the workflow designer.</p> <p>So I created a xaml file which describe exactily the same thing, and I load it like this:</p> <pre><code>return ActivityXamlServices.Load("Workflows/WorkflowSample.xaml") as DynamicActivity; </code></pre> <p>But then I got this exception:</p> <pre><code> System.Xaml.XamlObjectWriterException occurred Message=Impossible de créer le type inconnu '{clr-MyTestNameSpace.UserInterface.WorkflowItems}WaitForNextCall'. Source=System.Xaml LineNumber=0 LinePosition=0 StackTrace: à System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType) à System.Xaml.XamlWriter.WriteNode(XamlReader reader) [...] </code></pre> <p>I double-checked, the file is present(it appears, that there is another error message when file isn't specified correctly). But it cannot find my "WaitFornextCall" class, which is used just several lines below.</p> <p>I'm a little desesperate, I'm trying to understand how works Workflow foundations, but it's a little hard for now :(</p> <p>Any advice will be welcome</p> <p>Edit: I tried this to read the file, I don't have any exception in my constructor, but I don't know why, some libraries I'm using(ActiPro) seems to doesn't work anymore after the load:</p> <pre><code> XamlReader reader = new XamlXmlReader("Workflows/WorkflowSample.xaml", new XamlXmlReaderSettings(){LocalAssembly = System.Reflection.Assembly.GetExecutingAssembly()}); return ActivityXamlServices.Load(reader); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload