Exception during locking windows user

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

MirroZV
Posts: 15
Joined: Wed May 13, 2020 10:41 am

Exception during locking windows user

Post by MirroZV » Fri May 14, 2021 8:26 am

Hello,
we use lightning chart to display curves as a result of some process. Our customer reported us problem with following exception:

The steps what he did - lock and unlock the windows user. The problem is, we are not able to reproduce it, but it happened few months ago at other customer. Could it be related to graphic card/screen resolution/rendering?

Code: Select all

SharpDX.SharpDXException: HRESULT: [0x88760870], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: Unknown
   at SharpDX.Result.CheckError()
   at SharpDX.Direct3D9.Device.Reset(PresentParameters[] presentationParametersRef)
   at Arction.RenderingEngine11.RenderingEngine11.ND()
   at Arction.RenderingEngine11.RenderingEngine11.Dispose(Boolean disposing)
   at Arction.Wpf.SemibindableCharting.LightningChartUltimate.RAD(Boolean A)
   at Arction.Wpf.SemibindableCharting.LightningChartUltimate.QAD(Boolean A)
   at Arction.Wpf.SemibindableCharting.LightningChartUltimate.RFC(Boolean A)
   at Metrohm.Controls.Chart.ChartControl.Dispose(Boolean disposing)
   at Metrohm.Miami.Presentation.View.SubstanceModel.CurvesAndData.LiveViewControl.OnUnloaded(Object sender, 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.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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   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)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.MessageBox(HandleRef hWnd, String text, String caption, Int32 type)
   at System.Windows.MessageBox.ShowCore(IntPtr owner, String messageBoxText, String caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
   at Metrohm.Miami.Desktop.App.ShowUnhandledException(Exception e)
   at System.Windows.Threading.Dispatcher.CatchException(Exception e)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   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)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.MessageBox(HandleRef hWnd, String text, String caption, Int32 type)
   at System.Windows.MessageBox.ShowCore(IntPtr owner, String messageBoxText, String caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
   at Metrohm.Miami.Desktop.App.ShowUnhandledException(Exception e)
   at System.Windows.Threading.Dispatcher.CatchException(Exception e)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

ArctionKestutis
Posts: 411
Joined: Mon Mar 14, 2016 9:22 am

Re: Exception during locking windows user

Post by ArctionKestutis » Fri May 14, 2021 1:20 pm

Hello,
SharpDXException is not very informative. You should try subscribing to Chart.ChartMessage event and checking whatever there is other messages, which could explain what is happening.
When Windows session/user is locked, Windows takes away monitor/rendering-device from all applications (this is normal behavior). If there is no rendering device, then LigghtningChart is also not renders, because it obeys the general rules. ChartMessage report about such event (with severity level ‘Information’) – FrontBufferNotAvailable / FrontBufferAvailable.
As result of rendering-device removal, Rendering Engine of LightningChart should be disposed and re-create when user login to Windows.
So it seems from StackTrace, that somewhere this disposing or re-creation of Rendering Engine went wrong.
Not sure that graphic drivers could be the reason for the exception - then user should have difficulties with starting application in the first place. Another interpretation would be the "object sharing" error, which would prevent normal disposal (see User Manual chapter 28.1 Sharing objects between other objects for the description of problem).
To produce more definite answer, we would need to know how reproducible is the problem, what are the steps to reproduce, what ChartMessage is reporting?

MirroZV
Posts: 15
Joined: Wed May 13, 2020 10:41 am

Re: Exception during locking windows user

Post by MirroZV » Mon May 17, 2021 9:39 am

Can this `object sharing` lead to that exception?

ArctionKestutis
Posts: 411
Joined: Mon Mar 14, 2016 9:22 am

Re: Exception during locking windows user

Post by ArctionKestutis » Mon May 17, 2021 2:14 pm

With "object sharing" all kind of random errors could be expected. Therefore, in theory it may lead to this exception as well (at least, that is my assumtion). Are you getting ChartMessage about this type of error/warning?