Pre loader

Crashes with no explanation

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
0
0

My application is crashing only on one machine. I’ve narrowed it down to SciChart as my application doesn’t crash when I’ve removed SciChart from the UI.

At first I assumed it was potentially related to the visual accelerator engine; however, I removed that from my surface style and switched back to HighQualityRenderSurface and it still crashes.

It should be noted that I have not yet displayed anything on the SciChartSurface when this happens.

Here is what I initially had.

<Style x:Key="SurfaceStyle" TargetType="s:SciChartSurface">
    <Setter Property="Background" Value="White"/>
    <Setter Property="Padding" Value="0,0,10,0"/>
    <Setter Property="s:VisualXcceleratorEngine.IsEnabled" Value="True" />
    <Setter Property="s:VisualXcceleratorEngine.DowngradeWithoutException" Value="True" />
    <Setter Property="s:VisualXcceleratorEngine.FallbackType" Value="{x:Type s:HighQualityRenderSurface}" />
    <Style.Triggers>
        <Trigger Property="componentModel:DesignerProperties.IsInDesignMode" Value="False">
            <Setter Property="s3d:DirectXHelper.TryApplyDirectXRenderer" Value="True" />
            <Setter Property="s3d:DirectXHelper.FallbackType" Value="{x:Type s:HighQualityRenderSurface}" />
        </Trigger>
    </Style.Triggers>
</Style>

This is after I removed the Xccelerator.

<Style x:Key="SurfaceStyle" TargetType="s:SciChartSurface">
    <Setter Property="Background" Value="White"/>
    <Setter Property="Padding" Value="0,0,10,0"/>
    <Setter Property="RenderSurface">
        <Setter.Value>
            <s:HighQualityRenderSurface />
        </Setter.Value>
    </Setter>
</Style>

Any help is greatly appreciated. This is a time sensitive problem. Thanks.

Version
6.1.0.13075
  • Chris Kirkman
    New information, an older version of my software that used an older version of the SciChart does NOT crash. That version was 5.2.1.11757.
  • Chris Kirkman
    Some additional troubleshooting I have performed. I’ve verified that the target problem machine has DirectX 12 (same as the machines that don’t crash).
  • You must to post comments
Good Answer
0
1

Hi Chris

OnRenderFault fires an event that you can subscribe to and write out the exception. It also writes to Trace.WriteLine so if you were to enable the flag TRACE in your application you should see it in the visual studio console window.

Can you do that and post the exception here?

        sciChartSurface.OnRenderException += (s, arg) =>
        {
            string theMessage = arg.Exception.Message;
            string theStackTrace = arg.Exception.StackTrace;
        };

Best regards,
Andrew

  • Chris Kirkman
    :) Was ahead of you on this one. I had just added it and a barrage of errors occurred. If you recall I had added my own custom ZoomModifier and ViewPortManager. I get errors raised that indicate something going on there, but nothing necessarily helpful to me. I’m attaching those errors as well. I’ll try to attach those 2 classes also.
  • Chris Kirkman
    Andrew, I’d read that there is a possibility a specific C++ runtime that could be required. Is that something that could be a factor?
  • Chris Kirkman
    I’m going to mark this as the best answer to a problem that I’ve never really been able to resolve. I was able to use this event to help track down the exception being thrown; however, I still don’t understand why it was being thrown. In my scenario the view port to which I was binding was null at the time the chart was being displayed; however, I never created the user control on which the SciChart existed until AFTER I created an instance of my view port property in my view model. I was able to add the following in the XAML for my chart ViewportManager=”{Binding Path=Viewport, TargetNullValue={x:Type s:DefaultViewportManager}}” which allowed the chart to fallback to the default view port that is used by SciChart when the one that is to be bound to cannot be found. In my case I have an IViewPortManager property in my view model named “Viewport” which is the item to which the SciChart’s view port is bound. This resolved my immediate problem but can’t explain why an instance of SciChart, that didn’t even exist, was trying to bind to an object in my model, which also didn’t yet exist. I’ll have to concede that I’m likely missing something as I have to admit that I would hope that the .NET application isn’t using some sort of clairvoyance and guessing what objects I may intend to create at some time in the future. :)
  • Andrew Burnett-Thompson
    I’ve worked on various projects and honestly, would put this one down to WPF Wierdness! If the TargetNullValue or FallbackValue works then that is a solution. WPF is clearly trying to instantiate something before it should be, and before the bindings have evaluated.
  • You must to post comments
0
0

I think I’m going to classify this as a SciChart bug.

For reasons I can’t understand since I’m not even creating an instance of my chart user control until after I’ve created an instance of my model (contains the viewport I implemented) the chart is (rightly) finding that the viewport it is bound to is null; however, it then throws a null reference exception instead of handling the exception internally. I’m feeling confident that SciChart is attempting to add this exception to the Event log with no success which is why the exception causes a crash; however, this shouldn’t be an issue that causes a crash. Luckily I can handle it in OnRenderException(object sender, SciChart.Charting.Visuals.SciChartExceptionEventArgs e).

I’m going to have to recommend that instead of effectively crashing, the chart needs to just ignore that the viewport class is unavailable and use the default instead. This would be the same behavior as if I didn’t have a property in my view model pertaining to the renderable series or most any other bound property in the XAML for the chart surface.

  • Andrew Burnett-Thompson
    If you didn’t set a custom viewport the crash wouldn’t happen right? And because of binding latency (likely) its null during the draw phase. We rightly throw an exception here – you need a viewportmanager. Otherwise we introduce subtle latent bugs where users say ‘scichart doesnt respect my viewportmanager’. The fix is to use Fallback value in bindings. If you’re still stuck, submit a solution to reproduce and we can advise.
  • Chris Kirkman
    Thanks. How would I set the fallback for the viewport? Remember the view model doesn’t even exist yet when the chart is trying to bind. I still don’t understand how that’s happening.
  • Chris Kirkman
    Are you talking about something like this? ViewportManager=”{Binding Path=Viewport, TargetNullValue={x:Type s:DefaultViewportManager}}” If yes, that is very cool. I never even knew this was an available option for WPF binding. I guess that’s what I get for being the only developer in my company using WPF and nobody to bounce these things off of.
  • You must to post comments
0
0

I added some global error handling in the app.xaml.cs class and found the following error. It’s related to a “RenderFault”. Then looks like it’s trying to log to the EventLog and I’m assuming there is either a permissions issue with writing to the EventLog or the source within the EventLog doesn’t exist in which case there is a failure at that point.

Images
  • You must to post comments
0
0

See additional errors that were raised in the following handler

    private void DoseChart_OnRenderException(object sender, SciChart.Charting.Visuals.SciChartExceptionEventArgs e)
    {
        WpfMessageBox box = new WpfMessageBox($"{e.Exception.Message}\r\n\r\n{e.Exception.StackTrace}");
        box.ShowDialog();
    }
Attachments
Images
  • Chris Kirkman
    I kind of feel like the additional errors I have included are more than likely related to the first message however. These are handled/displayed after the first big one.
  • Chris Kirkman
    I added a null check on the renderPassInfo in the protected override IRange OnCalculateNewYRange(IAxis axis, RenderPassInfo renderPassInfo) since I wasn’t doing that before; however, same problem.
  • Andrew Burnett-Thompson
    Great info. The ViewportManager is null and you have a custom viewport manager throwing an error. If you’re binding to the ViewportManager property, perhaps that binding is failing? Either way looks like the error is due to the way you’ve configured SciChart via custom ViewportManager rather than the chart itself.
  • Chris Kirkman
    In my custom implementation of the DefaultViewportManager I added some additional code beyond the null check since one of my errors said “sequence contains no elements”. I’m waiting on my tester to try the newest build but here’s hoping that the additional check of if (null != renderPassInfo && null != renderPassInfo.DataSeries && 0 != renderPassInfo.DataSeries.Length) will keep that from happening. If it does solve the issue I’m wondering why this isn’t happening on the machines that are working.
  • Chris Kirkman
    Andrew, I agree that is where I need to spend some time tracking down where I’m having the breakdown. I’m still curious why this is only happening on one machine and not others. The environment otherwise is the same. I’ve logged into the same database that my client is using with no issues. Looks like I’m going to be adding a few null checks in my custom viewport until I track it down. ;)
  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies