none
Cannot set Unknown Member on ActivityXamlServices.Load() RRS feed

  • Question

  • I am having an issue deserializing an Activity when trying to deserialize without the context of a re-hosted WorkflowDesigner. I am working on a scenario in which users can run our application with the UI and manipulate Workflows in the Workflow desiger or simply load and execute an activity from the command line.

    The code for deserializing the Activiy works great as long as there is a UI involved. When I attempt to deserialize it without the UI I get an XamlObjectWriterException error:

    "'Cannot set unknown member '{http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation}VirtualizedContainerService.HintSize'.' Line number '1' and line position '96'."

    Here is the code that performs the deserialize where _xamlActivity is a string containing the xaml:

    NativeActivity nativeActivity = ActivityXamlServices.Load(new StringReader(_xamlActivity)) as NativeActivity;

    I have also tried the following, thinking it might have something to do with my local assembly as mentioned elsewhere on this forum. This was not my problem however.

    XamlXmlReaderSettings settings = new XamlXmlReaderSettings();

    settings.LocalAssembly = System.Reflection.Assembly.GetAssembly(typeof(SerializableActivity));

    XamlXmlReader reader = new XamlXmlReader(new StringReader(_xamlActivity), settings);

    NativeActivity nativeActivity = ActivityXamlServices.Load(reader) as NativeActivity;


    Both fail.

    Anyone have any ideas on how to get my deserialize to ‘know’ VirtualizedContainerSevice?


    - jeremiah adams

    Tuesday, July 24, 2012 8:13 PM

Answers

  • I fixed this by setting the settings.LocalAssembly to

    Assembly.GetAssembly(typeof(VirtualizedContainerService));


    Which is System.Activities.Presentation


    - jeremiah adams

    • Marked as answer by jeremiahAdams Tuesday, July 24, 2012 9:25 PM
    Tuesday, July 24, 2012 9:25 PM