Exception on remote desktop connection

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
aelbuz
Posts: 12
Joined: Fri Sep 15, 2023 1:56 pm

Exception on remote desktop connection

Post by aelbuz » Mon Oct 09, 2023 7:30 am

Hi,

I'm using LightningChart 10.3.2.2 with non-bindable WPF and I got an issue on remote desktop connection, but I'm not sure what is wrong, so I will explain my scenario:

I have a polar chart that acts like a speedometer: Have one AnnotationPolar that looks like a needle, and one AxisPolar (not the default axis) for this needle. So when I need to update needle angle, I simply change the AxisPolar's AngleOrigin property instead of changing AnnotationPolar's RotateAngle or AxisValues (location/target).

The simplified code looks like this:

Code: Select all

public partial class SpeedometerChart : UserControl
{
    private readonly LightningChart chart;
    
    private AxisPolar needleAxis;
    private AnnotationPolar needle;
    
    public SpeedometerChart()
    {
        chart = new LightningChart();
        
        InitializeNeedleAndAxis();
        
        Content = chart;
    }
    
    private void InitializeNeedleAndAxis()
    {
        needleAxis = new AxisPolar(chart.ViewPolar);
        ... // Set other properties
        needleAxis.Visible = false;
        chart.ViewPolar.Axes.Add(needleAxis);
        
        needle = new AnnotationPolar(chart.ViewPolar, needleAxis);
        ... // Set other properties
        needle.LocationAxisValues.SetValues(0, 0);
        needle.TargetAxisValues.Amplitude = needleAxis.MaxAmplitude;
        chart.ViewPolar.Annotations.Add(needle);
    }
    
    public void SetNeedleAngle(double angle)
    {
        chart.BeginUpdate();
        
        needleAxis.AngleOrigin = angle;
        
        chart.EndUpdate();
    }
}
I'm updating this needle at certain interval of times (i.e. per 50 milliseconds) with using DispatcherTimer that runs on the UI thread.

I'm running this project on my computer directly and the chart runs and updates with no problem. But when I connected to my computer via Windows Remote Desktop Connection, the chart throws an exception rarely; with "Could not load file or assembly 'System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified". error.

The stacktrace shortly looks like this:

Code: Select all

...
    at Arction.Wpf.Charting.LightningChart.HandleChartMessage(...)
    at Arction.Wpf.Charting.LightningChart.DrawChartMain()
    at Arction.Wpf.Charting.LightningChart.EndUpdateInternal(Boolean enableRepaint)
    at SpeedometerChart<BeginUpdate>b__68_0()
    at SpeedometerChart.SetNeedleAngle(double angle)
    at SpeedometerChartViewModel.UpdateNeedle(double angle)
...
The ExceptionInfo/SytemInfo/ChartInfo inside the Arction.Wpf.Charting.ChartException shortly looks like this:

ExceptionInfo:

Code: Select all

MessageSeverity: Recoverable Error
MessageType: Unknown
Details: Could not load file or assembly 'System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
Chart: LightningChart .NET
Source: System.Private.CoreLib
Description: Unknown message type
SytemInfo:

Code: Select all

AvailableRam: 7415 MB
UsedRam: 1247.6719 MB
Gen0HeapSize: 0
Gen1HeapSize: 0
Gen2HeapSize: 0
FinalizationSurvivors: 0
OS: Microsoft Windows NT 10.0.19045.0
Is64bit: True
CultureInfo: en-US
NetFrameworkVersion: v4.0.30319
ChartInfo:

Code: Select all

CreatedCount: 1
AliveCount: 1
DisposedCount: 0
UndisposedCount: 0
Id: 0
LicenseStatus: 1
Version: 10.3.2.4002
NagText: (one time this field is empty, but another time I get "No valid license available." error)
LastErrorHandled: False
ThrowChartErrorsEnabled: False
DeploymentKeyChanged: False
DebuggerAttached: False
IsDPIAware: True
... // Other properties
RenderOptions:
    RenderDevice:
        Description: NVIDIA Quadro K620
        RenderedDeviceType: DX11 Hardware
        Render device created: Yes
        Pure device: Yes
        Memory on graphics card: 2006 MB
        ... // Other properties
    ActiveObjects:
        EngineInitResults:
            Last Engine Init Results:
                DeviceType: HardwareOnlyD11
                Success: True
                Warnings: None
                Exceptions: None
        ... // Other properties
    ChartScreenPosition:
        ChartWidth: 638
        ChartHeight: 370
        ActiveView: ViewPolar
I'm using RDP very often but I have encountered this situation twice so far and I'm not sure what is wrong. Do you have any thoughts for this situation?

Thanks in advance.

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

Re: Exception on remote desktop connection

Post by ArctionKestutis » Mon Oct 09, 2023 8:08 am

We invested a lot of time to investigate issue in the past. We manage to create application where issue could be replicated. However, I almost 99% certain that this particular issue is not LightningChart problem.
Similar issue have been described before in application completely unrelated to LightningChart (for example). The common interpretation of this exception/problem - Visual Studio can't figure out the correct <bindingRedirect>. Whatever it is Visual Studio error or developers not following guidelines is open for the debate. It may be important to note, that only one version of any package can be used in the project (see Dependency resolution rules).

As for solution, there are several options. One is to add specific NuGet package in the project and exception (Could not load file or assembly) should be fixed. It is also possible to add few lines in project’s configuration file to force correct <bindingRedirect>. The ways to do later one is discussed in stackoverflow forum link I shared above.

Note concerning System.ComponentModel.Composition package. If used together with LightningChart, check which version is compatible. Different System.ComponentModel.Composition versions compatible with different .NET Framework version, so are LightningChart's versions (information could be found at www.nuget.org/packages).

Hope this helps.

aelbuz
Posts: 12
Joined: Fri Sep 15, 2023 1:56 pm

Re: Exception on remote desktop connection

Post by aelbuz » Wed Oct 11, 2023 9:16 am

Hi Kestutis,

Thanks for the answer.

I forgot to say that I'm using .NET 6 in my project. Also I'm not using System.ComponentModel.Composition package in my application but LightningChart does. So do you have any thoughts that there might be an incompatibility between .NET 6 and .NET Framework?

Regards.

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

Re: Exception on remote desktop connection

Post by ArctionKestutis » Wed Oct 11, 2023 1:37 pm

.NET Framework control is perfectly compatible with .NET 6.0 application.
Yes, LightningChart has reference to System.ComponentModel.Composition, but I should be used very seldom. The issue not manifested in each and every .NET 6 project. Therefore, it could some other things/references that trigger it.

Post Reply