locked
Strange NullReferenceException when rehosting WorkflowDesigner. RRS feed

  • Question

  • I have received the following error when rehosting the workflow designer:

    Message : Object reference not set to an instance of an object.
    Exception : System.NullReferenceException: Object reference not set to an instance of an object.
       at System.Activities.Presentation.WorkflowViewElement.<.ctor>b__1(Object sender, RoutedEventArgs eventArgs)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
       at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
       at System.Windows.BroadcastEventHelper.BroadcastUnloadedEvent(Object root)
       at MS.Internal.LoadedOrUnloadedOperation.DoWork()
       at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
       at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

    This error occurs in the following conditions:

    • WorkflowDesigner is created and loaded after the hosting UserControl is Loaded. If I create this in the constructor or sometime before the Loaded event, this never happens.
    • The first time the WorkflowDesigner is created and loaded. If I close the control and create the WorkflowDesigner again, the problem does not appear (until I shutdown the process and run it again).

    I have worked around this by always creating the WorkflowDesigner in the constructor, however, I would like to be able to have the user choose to load it after the user control has loaded.

    Is this a known issue? If so, which .NET version will this be fixed in?

    Wednesday, July 20, 2011 11:39 AM

Answers

  • For a clear WF4 bug report like this, a great thing to do it is submit it to (WF) connect https://connect.microsoft.com/wf 
    Assuming the product team can repro it from your repro information, they will get back to you on whether they know about the issue and their thoughts on fixing it. (They may consider it less important to fix in this case since you have a workaround.)
    Tim
    • Marked as answer by Andrew_Zhu Wednesday, July 27, 2011 7:54 AM
    Thursday, July 21, 2011 3:51 AM

All replies

  • For a clear WF4 bug report like this, a great thing to do it is submit it to (WF) connect https://connect.microsoft.com/wf 
    Assuming the product team can repro it from your repro information, they will get back to you on whether they know about the issue and their thoughts on fixing it. (They may consider it less important to fix in this case since you have a workaround.)
    Tim
    • Marked as answer by Andrew_Zhu Wednesday, July 27, 2011 7:54 AM
    Thursday, July 21, 2011 3:51 AM
  • I should also point out that I'm using the workflow rehosting with the Prism4 framework. Could it be that Prism and WorkflowDesigner do not work well together?
    Monday, July 25, 2011 9:18 AM