Unhandled exception when switching to the MGEN view after reconnecting all devices

Issue #661 resolved
Francesco Meschia created an issue

When I switch to the MGEN view under “Equipment” after using the “Reconnect All Devices” button (or F5 shortcut), I get the attached error message. If I reply “Yes”, NINA continues, but the MGEN virtual UI is not rendered.

In the log, I see this:

[2020-10-31T18:18:05.6021] [ERROR] [MemberName] Application_DispatcherUnhandledException
[2020-10-31T18:18:05.6021] [ERROR] [FileName] C:\Users\Francesco\Documents\Dev\NINA\NINA\App.xaml.cs
[2020-10-31T18:18:05.6021] [ERROR] [Message] Must create DependencySource on same Thread as the DependencyObject. at System.Windows.DependencyObject.ValidateSources(DependencyObject d, DependencySource[] newSources, Expression expr)
at System.Windows.Expression.ChangeSources(DependencyObject d, DependencyProperty dp, DependencySource[] newSources)
at System.Windows.Data.BindingExpressionBase.ChangeSources(WeakDependencySource[] newSources)
at MS.Internal.Data.ClrBindingWorker.ReplaceDependencySources()
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.AttachDataItem()
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Run(Object arg)
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)

This seems to be related to the fact that, when re-connecting all devices, the panel that contains the MGEN virtual UI is updated in a thread which is not the same thread that renders the UI. Or something similar, I apologize but I’m not familiar with the Microsoft UI model. For this reason, I am unfortunately unable to try to solve this myself.

Thanks,

Francesco

Comments (3)

  1. Log in to comment