locked
Rehosting the WF Designer results always in a NullReferenceException RRS feed

  • Question

  • Hello,

    I wanted to rehost the Workflow Designer in .NET 4.0 RC. But I have the same problems like in the beta before. It doesn't works. On loading the Designer I get always a NullReferenceException like below:

    System.NullReferenceException: Object reference not determined to an object
     instance (or something like that, I get
     only the german error message) 
       at System.Windows.ResourceDictionary.GetKeyValue(KeyRecord key, IServiceProvider serviceProvider)
       at System.Windows.ResourceDictionary.SetKeys(IList`1 keyCollection, IServiceProvider serviceProvider)
       at System.Windows.ResourceDictionary.SetDeferrableContent(DeferrableContent deferrableContent)
       at System.Windows.Baml2006.WpfSharedBamlSchemaContext.<Create_BamlProperty_ResourceDictionary_DeferrableContent>b__168(Object target, Object value)
       at System.Windows.Baml2006.WpfKnownMemberInvoker.SetValue(Object instance, Object value)
       at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)
       at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
       at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.SetValue(Object obj, XamlMember property, Object value)
       at System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent)
       at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)
       at System.Xaml.XamlObjectWriter.WriteEndMember()
       at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
       at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
       at MS.Internal.AppModel.AppModelKnownContentFactory.BamlConverter(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)
       at MS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStream(Stream s, ContentType contentType, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)
       at ei System.Windows.ResourceDictionary.set_Source(Uri value)
       at System.Activities.Presentation.CachedResourceDictionaryExtension.ProvideValue(IServiceProvider serviceProvider)
       at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
       at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
       at System.Xaml.XamlObjectWriter.Logic_ProvideValue(ObjectWriterContext ctx)
       at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx)
       at System.Xaml.XamlObjectWriter.WriteEndObject()
       at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
       at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at System.Activities.Presentation.View.DesignerView.InitializeComponent()
       at System.Activities.Presentation.View.DesignerView..ctor(EditingContext context)
       at System.Activities.Presentation.View.WorkflowViewManager.Initialize(EditingContext context)
       at System.Activities.Presentation.WorkflowDesigner.GetViewManager(ModelItem modelItem)
       at System.Activities.Presentation.WorkflowDesigner.Load(Object instance)
       at System.Activities.Presentation.WorkflowDesigner.Load()
    

    No single one example will work. The message above I'm getting in the window which is the host for the desiger when I use these example:
    http://msmvps.com/blogs/theproblemsolver/archive/2009/12/23/rehosting-the-workflow-designer-in-wf4.aspx


    The Microsoft example (WF WCF Samples) for rehosting doesn't work too (http://www.microsoft.com/downloads/details.aspx?FamilyID=35ec8682-d5fd-4bc3-a51a-d8ad115a8792&displaylang=en ). In the line

    wd.Load(new
     Sequence());
    

    I'm getting the message
    NullReferenceException unhandled by
     user code
    

    Does anybody have an idea?

    Actually I'm working with VS2010 Professional RC.

    Thank you very much.


    Greetings
    One

    • Edited by Onemahutu Tuesday, March 9, 2010 7:18 PM Formatting
    Tuesday, March 9, 2010 7:15 PM

All replies

  • I can't repro this on my machine.
    I guess it's maybe machine setup issue.
    could you try on other machines?

    Tuesday, March 9, 2010 7:25 PM
  • and could you help try this code?

    Window win = new Window();
    new DesignerMetadata().Register();
    WorkflowDesigner designer = new WorkflowDesigner();
    designer.load(new Sequence());
    win.content = designer.View;
    win.show();
    Tuesday, March 9, 2010 7:29 PM
  • could you also take a look whether you can use workflow console app in VS?
    Tuesday, March 9, 2010 9:27 PM
  • Hello,

    before I asked this question, I had testet this on two machines (XP 32-Bit and 7 64-Bit). Both have the same Problem. Anyway, I have tested it again today on another two XP 32-Bit machines and it works. Exact the same VS2010 RC installation and exact the same Project. On two machines it works, on another two it doesn't. The only thing where the systems differ is the system BEFORE installation. On the two machines where it runs was no VS2010 Beta oder .NET 4.0 Beta installed before. On the other two machines where it doesn't work was VS2010 Beta and .NET 4.0 Beta installed before installation of VS2010/.NET 4.0 RC. But there were uninstalled before installation of the RC. It sounds a little strange, but this is the only thing where the systems differs. Could this be the reason for this problem?

    Thanks for your answers.


    Greetings

    One
    Wednesday, March 10, 2010 2:29 PM
  • I think this is a totally installation issue.
    to finally confirm this problem, could you help check whether you can launch workflow console application on VS on the two machines which don't work?
    Wednesday, March 10, 2010 6:08 PM
  • Actually I can't test this on both. But on one of them a simple console application on VS works smoothly.
    Thursday, March 11, 2010 1:05 PM
  • sorry, do you mean a workflow console application or C# console application?
    could you drag drop activity designers to that workflow console applicaiton?
    Thursday, March 11, 2010 5:02 PM
  • No problem. I want your help.
    I used a workflow console application with a simple workflow (writeLine activity). I had no problems to drag and drop the activities into that workflow and had no problems to run it. This is what you meant?
    Thursday, March 11, 2010 5:54 PM
  • I double checked your stack trace, and you mentioned the machines which don't work were installed beta before.
    so I think this is a totally machine setup issue.

    Please let me know if you see this problem again even you install VS on a clean mahcine.
    Thursday, March 11, 2010 6:02 PM
  • The problem are the german resources, you´ve just to delete this file: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Activities.Presentation.resources\v4.0_4.0.0.0_de_31bf3856ad364e35
    Saturday, April 3, 2010 11:22 AM