Lightning chart application crash, when connected to app via RDP

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

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

Lightning chart application crash, when connected to app via RDP

Post by MirroZV » Mon Jan 11, 2021 7:59 am

Hello,
we have problem, when somebody is connected via RDP (remote desktop) and uses our application (lightning chart is part of it), we get an application crash. After investigation we figured out, that it is related to lightning chart component. I attach log. Do you know, where the problem could be?

Many Thanks.
Arction.Wpf.SemibindableCharting.ChartException: Render device create failed.: Rendering engine initialization failed. None of the requested engines could be loaded.

For more information, use GetLastEngineInitResults() method. ---> 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.HBD()
--- End of inner exception stack trace ---
at Arction.Wpf.SemibindableCharting.LightningChartUltimate.IIC(MessageSeverity A, MessageType C, Object F, String H, String I, Boolean J, Exception K)
at Arction.Wpf.SemibindableCharting.LightningChartUltimate.HBD()
at Arction.Wpf.SemibindableCharting.LightningChartUltimate.QOD(IntPtr A, Int32 C, IntPtr F, IntPtr H, Boolean& I)
at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(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)

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

Re: Lightning chart application crash, when connected to app via RDP

Post by ArctionKestutis » Tue Jan 12, 2021 10:12 am

Hello,

The problems with remote connection and LightningChart are very rare. It is probably something specific for user’s environment and/or hardware.
How reproducible is the crash? What is the sequence of steps? Is application crash only it was interrupted by RDP connection? Or app could not be started/run, if Remote connection is on?
Subscribe to _chart.ChartMessage event and log messages in event handler. This will test whatever LightningChart could handler error internally and provide more information about event preceding crush.

Hope this helps.

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

Re: Lightning chart application crash, when connected to app via RDP

Post by MirroZV » Tue Jan 12, 2021 11:48 am

The application is possible to run via RDP. It crashes only, when I display curves on lightning chart component and get attached error.

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

Re: Lightning chart application crash, when connected to app via RDP

Post by ArctionKestutis » Thu Jan 14, 2021 10:27 am

Any update what ChartMessage tells? And whatever subscribing to event eliminated crashes?

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

Re: Lightning chart application crash, when connected to app via RDP

Post by MirroZV » Tue May 18, 2021 7:51 am

When I set property ChartRenderingOptions.DeviceType = SoftwareOnlyD11, I don't get error with engine. Before there was always Hardware11. Most probably, using RDP there is no HW rendering possibility.

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

Re: Lightning chart application crash, when connected to app via RDP

Post by ArctionKestutis » Tue May 18, 2021 8:35 am

It is always good idea to keep DeviceType as 'Auto', 'AutoPreferd9' or 'AutoPreferD11' option. This allows some fall back handling in case of drivers problem. In general, LightningChart® .NET tries to keep rendering result between Rendering Engine 9 and 11 very similar. Unless you have very specific reason to go for DirectX 11 or DirectX 9 drivers only, you should use 'Auto*' option.
There are many different software to create remote connection or virtual machine. Typically each of them have display drivers of their own (not using computer's graphic drivers directly). Users should take care to verify that their system support GPU acceleration and DirectX. Without such support LightningChart® .NET will not work as it normally does.

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

Re: Lightning chart application crash, when connected to app via RDP

Post by MirroZV » Tue May 18, 2021 11:56 am

One thing I would like to clarify. When I subscribe on ChartMessage, than I don't get exception about rendering engine, application does not crash. But when I don't subscribe on it, and don't set SoftwareOnlyD11, I get error. Is it enough to be subscribed on the ChartMessage event to prevent engine exception?

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

Re: Lightning chart application crash, when connected to app via RDP

Post by ArctionKestutis » Tue May 18, 2021 12:44 pm

If ChartMessage report message's MessageSeverity level as RecoverableError, then it is type of error chart could easily recover. However, it requires for user to listen for Chart.ChartMessage. Otherwise, chart will throw exception (to bring error to user's attention).
If reasons for RecoverableError are perfectly normal/understood, then user can ignore error. However, if it come in log file unexpectedly, then it may indicate that something is wrong with user's application code.

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

Re: Lightning chart application crash, when connected to app via RDP

Post by MirroZV » Tue Oct 26, 2021 12:34 pm

Hello guys,

after some time, we got an similar exception again.

System.ArgumentException: Back buffer's device is not valid. ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x88980803
--- End of inner exception stack trace ---
at System.Windows.Interop.D3DImage.SetBackBuffer(D3DResourceType backBufferType, IntPtr backBuffer, Boolean enableSoftwareFallback)
at Arction.RenderingEngine11.RenderingEngine11.OnWpfImageChange()
at Arction.RenderingEngine.RenderingEngineBase.SetWPFImage(Object image)
at Arction.Wpf.SemibindableCharting.LightningChartUltimate.LOD()
at Arction.Wpf.SemibindableCharting.LightningChartUltimate.NWC(EngineMessageInfo A)
at Arction.RenderingEngine.RenderingEngineBase.set_FrontBufferAvailable(Boolean value)
at Arction.RenderingEngine.RenderingEngineBase.OnIsFrontBufferAvailableChanged(Object sender, DependencyPropertyChangedEventArgs e)
at System.Windows.Interop.D3DImage.IsFrontBufferAvailablePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.Freezable.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value)
at System.Windows.Interop.D3DImage.SetIsFrontBufferAvailable(Object isAvailableVersionPair)
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)

Our tester told me, that he executed application via RDP, then, after few days, logged in into computer locally (no via RDP) and after login, he saw this issue above.
Do you have advice, what can be wrong? Can it be because of RDP? SOmething wrong with VGA? Thanks for any response

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

Re: Lightning chart application crash, when connected to app via RDP

Post by ArctionKestutis » Wed Oct 27, 2021 12:44 pm

As before, main question is how easily you can replicate it. Ideally we would like to have application, where issue is replicated. This make finding the reasons and fixing much more easy.
If it is one-time-issue, then it would be nice to have crash dump or memory dump. Especially if nobody else reported same/similar problem before. "Back buffer's device is not valid" message indicates that there are wrong parameters while creating D3DImage. Dump file may help to answer that.
It seems that in stacktrace there is also ChartMessage event. Is your application subscribes to _Chart.ChartMessage and did you logged those messages?

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

Re: Lightning chart application crash, when connected to app via RDP

Post by MirroZV » Wed Oct 27, 2021 1:44 pm

Thanks for reply :)

Unfortunately, this issue is happening very rarely.
We dont have crash dump file but our tester already enabled this feature and next time I hope that I will able to provide it.

We are subscribed to ChartMessage but we are not logging a message there, should we log there something (specific property)? Will be there more information as I already provided?

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

Re: Lightning chart application crash, when connected to app via RDP

Post by ArctionKestutis » Thu Oct 28, 2021 7:44 am

Checking that LightningChart have to say would be useful. Some message maybe just informative (e.g. FrontBuffer available indicates windows session started and application got monitor), other message may indicate bigger problem. But it all depend on the context those message appear. One way to log messages is to record to file as in following example.

Code: Select all

private void _chart_ChartMessage(ChartMessageInfo info)
{
          string msgInfo = info.ToString(); 

          // save INFO string to Logs =>
          using (StreamWriter writer = new StreamWriter(@"C:\temp\LightningChart_LOG.txt", true))
          {
                         string dateTime = DateTime.Now.ToString();
                         writer.WriteLine(dateTime);
                         writer.WriteLine("-------------------------------------------------------");
                         if (msgInfo != null)
                                 writer.WriteLine(msgInfo);
           }
}
This will save all information about message: time it was received, severity, type and details of message and stack-trace.

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

Re: Lightning chart application crash, when connected to app via RDP

Post by MirroZV » Thu Nov 25, 2021 8:02 am

Hello guys.

Error has happened again, but now we have a dump file :) (RDP is again in game)

May I ask you to check it?

You can download dump file here https://drive.google.com/drive/folders/ ... sp=sharing

Thanks