Application crash - Bug ?

Docking/MDI for WPF Forum

Posted 2 months ago by Martin de Jong - Statistics Netherlands
Version: 18.1.0673
Avatar

Hi

In some (rare) occasions an exception inside windows or actipro is thrown.  It looks like a popup menu closing caused this. The underlying sample i can reproduce doing (clicking on an button in a contextmenu, function breaking in debugger, continue code). Throwing occurs after fully executing command and closing context menu, maybe in querying CanExecutes? But other situation, like typing inside syntax editor can cause this error too, maybe related to the tooltips/intellisense in this case. Can you have a look?

Value cannot be null.
Parameter name: menuSite

StackTrace:
at System.Windows.Input.InputManager.PushMenuMode(PresentationSource menuSite)
at System.Windows.Controls.Primitives.MenuBase.OnPreviewKeyboardInputProviderAcquireFocus(Object sender, KeyboardInputProviderAcquireFocusEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
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.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
at System.Windows.UIElement.Focus()
at ActiproSoftware.Windows.Controls.Ribbon.UI.PopupControlService.<>c__DisplayClass76_0.<OpenPopup>b__0(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler

Comments (9)

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Martin,

In our internal PopupControlService.OpenPopup method, we do have a dispatched call to focus the first control in the popup.  This allows the popup's first focusable child control to have focus after display.  I believe that is the logic for our "PopupControlService" in your stack trace above.  The BeginInvoke is kicked off with DispatcherPriority.Background priority.

We are going to make a code update to check within that BeginInvoke'd logic to check whether the popup is still open before it tries to do the Focus() call.  I'm hopeful that will help, since perhaps you might be closing the popup before that BeginInvoke'd code executes.  If you'd like to test a preview build with that code update, please write our support address and mention this thread.


Actipro Software Support

Posted 2 months ago by Martin de Jong - Statistics Netherlands
Avatar

Thanks.

I think we wait till the release. In the meantime i'll try to find more situations (without debugger attached).

Posted 1 month ago by Martin de Jong - Statistics Netherlands
Avatar

It looks like this is occuring in the syntax editor, where the language defines a completion provider, which is there for years. Is there something changed in the completion provider (RequestSession?) handling in the last year(s)?

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Martin,

The code change we mentioned above to try and help hasn't been released yet.  Nothing in your stack trace mentions completion.  Why did you think that has something to with the problem?


Actipro Software Support

Posted 1 month ago by Martin de Jong - Statistics Netherlands
Avatar

Well, some users complain about this, while typing in the syntax editor. I assume that indirectly the intellisense popup is causing this exception. Could be that they type quick;)

Simular exeptions i get myself when breaking in the debugger after clicking on a context menu (popup button), so you are right assuming it is not directly related to the syntax editor. 

Just wanted you to get some context on the matter at hand. Anyway, is there a new release in sight?

Greeting

Martin

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Martin,

We aren't planning another 2018.1 release until close to when 2019.1 is ready.  If you'd like to try a 2018.1 preview build with the update, please write our support address and mention this thread.


Actipro Software Support

Posted 1 month ago by Martin de Jong - Statistics Netherlands
Avatar

I finally could reproduce this problem

Maybe you can take a look at this:

Message: "Object reference not set to an instance of an object."

StackTrace:
   at System.Windows.Controls.Primitives.Popup.OnWindowResize(Object sender, AutoResizedEventArgs e)
   at System.Windows.Interop.HwndSource.Resize(Size newSize)
   at System.Windows.Interop.HwndSource.OnLayoutUpdated(Object obj, EventArgs args)
   at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

  Name Value Type
Exception {"Object reference not set to an instance of an object."} System.Exception {System.NullReferenceException}
  ▶ Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
  HResult -2147467261 int
  HelpLink null string
  ▶ InnerException {"Cannot perform this operation while dispatcher processing is suspended."} System.Exception {System.InvalidOperationException}
  Message "Object reference not set to an instance of an object." string
  Source "PresentationFramework" string
  StackTrace " at System.Windows.Controls.Primitives.Popup.OnWindowResize(Object sender, AutoResizedEventArgs e)\r\n at System.Windows.Interop.HwndSource.Resize(Size newSize)\r\n at System.Windows.Interop.HwndSource.OnLayoutUpdated(Object obj, EventArgs args)\r\n at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()\r\n at System.Windows.ContextLayoutManager.UpdateLayout()\r\n at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)\r\n at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()\r\n at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)\r\n at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)\r\n at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)\r\n at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)" string
  ▶ TargetSite {Void OnWindowResize(System.Object, System.Windows.AutoResizedEventArgs)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
  ▶ Static members    
  ▶ Non-Public members    
Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Martin,

Are you still seeing this with the preview build we gave you the other day?   I don't see any Actipro code listed in this stack trace.

Looking at the reference source for Popup, it seems like it might throw that exception if another problem occurred during a measure phase:

https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/Primitives/Popup.cs


Actipro Software Support

Posted 1 month ago by Martin de Jong - Statistics Netherlands
Avatar

Well, it looks good.

I found a dispatcher.Invoke in the syntaxeditor eventhandler UserInterfaceUpdate which i replaced by a BeginInvoke. This could be the cause of all the trouble. Ill wait for the results of testing, but have good hopes:)

In the meantime, i suggest we consider this solved:)

Thanks

Martin

The latest build of this product (v2019.1 build 0681) was released 18 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.