Exception if ValueRangePalette steps are more than 6

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 if ValueRangePalette steps are more than 6

Post by aelbuz » Wed Oct 11, 2023 8:57 am

Hi,

I'm using LightningChart 10.3.2.2 with non-bindable WPF in a .NET 6 project and I get an exception when defining more than 6 steps in ValueRangePalette for IntensityGridSeries. This issue can also be reproducable on the "Vertically scrolling palette-colored spectrogram" demo in the interactive example, so I'm not posting the stackstace.

For example, I'm defining 7 color steps for spectrogram's ValueRangePalette. When I ran my application, it throws an InvalidOperationException twice, with message "Sequence contains no matching elements." in System.Linq.dll.

I got curious and printed all resource names in the `Assembly.GetExecutingAssembly().GetManifestResourceNames()` on `RenderingEngine11.ReadEmbeddedResourceFile()` methods. When the ValueRangePalette steps are less than 7, the rendering engine tries to find the resources named
  • Shaders.Precompiled.IntensityEffect2D_PSIntensityPixelMapSmoothPaletted_default.fxo
  • Shaders.Precompiled.IntensityEffect2D_VSIntensityVc_default.fxo
and finds them. But when the steps are i.e. 7, the rendering engine tries to find the resources named
  • Shaders.Precompiled.IntensityEffect2D_PSIntensityPixelMapSmoothPaletted_CONTOUR_ENTRY_COUNT7.fxo
  • Shaders.Precompiled.IntensityEffect2D_VSIntensityVc_CONTOUR_ENTRY_COUNT7.fxo
and cannot find them. Because there are no resources with these resource names, it throws the InvalidOperationException exception twice. When the engine cannot find these resources, then it finds the resource named
  • Shaders.Sources.IntensityEffect2D.fx.Encrypted
successfully and then continues. It seems that these exceptions have no effect on the application.

Is this an expected behavior? Or am I missing something?

Thanks.

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

Re: Exception if ValueRangePalette steps are more than 6

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

I could create 7, 8 and more palette steps in ExampleSpectrogram2D from our Demo (Interactive Examples App) without any problems.
You may need to be more specif, what do you mean about "exception". Is you application crashes or you just see debug messages?
Normally this event is handled internally without any issue for application, and required steps are created.

The complete message (for example, if you would be subscribing to Chart.ChartMessage event) is following
ChartMessage:
type: ShaderLoadingFailed
severity: Information
details: 'Failed to load precompiled shader at path Shaders.Precompiled.IntensityEffect2D_PSIntensityContourSmoothPalettedFillNoContourLine_CONTOUR_ENTRY_COUNT7.fxo. This usually indicates that no precompiled shader exists for currently selected settings, like palette step count or light count. This is not a problem as such, but compilation of the shaders can take a long time and thus slow down the LightningChart loading.'
source: RenderingEngine11
stackTrace: ''
The default shader is for 6 steps palette. The higher number of step will lead to need for shader-compilation. By itself it is not disaster, but will slightly increase loading time (due to shader compilation).

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

Re: Exception if ValueRangePalette steps are more than 6

Post by aelbuz » Thu Oct 12, 2023 12:44 pm

When I started my application, I see an InvalidOperationException on the Output (debug) panel in my Visual Studio. Because the InvalidOperationException is disabled in Visual Studio by default, I just see the message on the debug window until I enable it from Exception Settings panel. Of course this exception does not affect my application negatively, I just see it on the debug window.

If you say this is an expected behavior, then it's no problem for me. I just found odd that it threw an exception just because it couldn't find the default file.

Thanks for the information.

Post Reply