This is a migrated thread and some comments may be shown as answers.

Intermittent crash when rebinding chart

4 Answers 80 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Raj
Top achievements
Rank 1
Raj asked on 21 Apr 2011, 07:14 PM
Since updating to version 2011 Q1 of the Silverlight controls I've been experiencing intermittent crashes when the chart rebinds to new data. The following stack is produced...

System.Windows.Markup.XamlParseException: [Line: 0 Position: 0] ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Windows.Controls.Charting.SelfDrawingSeries.InitializeTopBorderLineGeometry()
at Telerik.Windows.Controls.Charting.SelfDrawingSeries.InitializeSeriesGeometry()
at Telerik.Windows.Controls.Charting.SelfDrawingSeries.OnApplyTemplate()
at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)

Although I'm not sure this is where the error originates, we're customizing the line and area series by setting the SeriesStyle to something similar to...

<Style x:Key="AreaStyle"
            TargetType="telerikCharting:SelfDrawingSeries">
            <Setter Property="BorderLineStyle">
                <Setter.Value>
                    <Style TargetType="Shape">
                        <Setter Property="Stroke" Value="#d59626" />
                        <Setter Property="StrokeThickness" Value="2" />
                    </Style>
                </Setter.Value>
            </Setter>
            <Setter Property="BackgroundStyle">
                <Setter.Value>
                    <Style TargetType="Shape">
                        <Setter Property="Fill" Value="#d59626" />
                        <Setter Property="Opacity" Value="0.3" />
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>

Have the structure of these styles changed from the previous version? This may not be the issue so if you have any other recommendations I would truly appreciate it.

Thanks,
Raj

4 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 27 Apr 2011, 07:06 AM
Hi Raj,

Could you, please, open a support ticket and send us a small sample application that reproduces this issue, so that our developers could debug it and provide further support. Any additional information on your specific scenario would also be greatly appreciated.

All the best,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Hannah
Top achievements
Rank 1
answered on 04 May 2011, 10:22 PM
Hi,

I am using version Q1 2011 and just implemented a new SeriesStyle for one of our charts.  When the chart rebinds I get the same error intermittently:

System.Windows.Markup.XamlParseException:  [Line: 0 Position: 0] ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Controls.Charting.SelfDrawingSeries.InitializeTopBorderLineGeometry()
   at Telerik.Windows.Controls.Charting.SelfDrawingSeries.InitializeSeriesGeometry()
   at Telerik.Windows.Controls.Charting.SelfDrawingSeries.OnApplyTemplate()
   at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)
   --- End of inner exception stack trace ---
   at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
   at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
   at MS.Internal.XcpImports.FrameworkElement_ApplyTemplate(FrameworkElement frameworkElement)
   at System.Windows.Controls.ItemContainerGenerator.LayoutStatesManager.GetElementRoot(Boolean templatesAreGenerated)
   at System.Windows.Controls.ItemContainerGenerator.LayoutStatesManager.Load()
   at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
   at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 containerIndex, DependencyObject container, Boolean needPrepareContainer)
   at System.Windows.Controls.ItemsControl.AddContainers()
   at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr unmanagedObj)

   at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
   at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
   at MS.Internal.XcpImports.Storyboard_Begin(Storyboard storyboard)
   at Telerik.Windows.Controls.Charting.SelfDrawingSeries.StartAnimation()
   at Telerik.Windows.Controls.Charting.SelfDrawingSeries.SelfDrawingSeriesLoaded(Object sender, RoutedEventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

The SeriesStyle I am using is:

 

 

 

 

 

 

<Style   x:Key="LineStyle1"
            TargetType="t:BaseLineSeries">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="t:BaseLineSeries">
                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  x:Name="PART_MainContainer">
                            <Grid.Clip>
                                <RectangleGeometry x:Name="PART_AnimationClipGeometry">
                                    <RectangleGeometry.Transform>
                                        <ScaleTransform x:Name="PART_AnimationTransform" ScaleX="0"/>
                                    </RectangleGeometry.Transform>
                                </RectangleGeometry>
                            </Grid.Clip>
                            <Path x:Name="PART_TopBorderLine"
                              Fill="Transparent"
                              Style="{TemplateBinding BorderLineStyle}" 
                              StrokeLineJoin="Round"
                              IsHitTestVisible="False">
                                <Path.Data>
                                    <PathGeometry x:Name="PART_TopBorderLineGeometry" />
                                </Path.Data>
                            </Path>
                            <ItemsPresenter />
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="HoverStates">
                                    <vsm:VisualState x:Name="Normal">
                                        <Storyboard>
                                            <DoubleAnimation To="1.0" Storyboard.TargetName="PART_MainContainer" Storyboard.TargetProperty="Opacity" Duration="0.00:00:00.15" />
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Hovered">
                                        <Storyboard>
                                            <DoubleAnimation To="1.0" Storyboard.TargetName="PART_MainContainer" Storyboard.TargetProperty="Opacity" Duration="0.00:00:00.15" />
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Hidden">
                                        <Storyboard>
                                            <DoubleAnimation To="0.25" Storyboard.TargetName="PART_MainContainer" Storyboard.TargetProperty="Opacity" Duration="0.00:00:00.15" />
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="SelectionStates">
                                    <vsm:VisualState x:Name="Unselected">
                                        <Storyboard>
                                            <DoubleAnimation To="0.25" Storyboard.TargetName="PART_MainContainer" Storyboard.TargetProperty="Opacity" Duration="0.00:00:00.15" />
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Selected">
                                        <Storyboard>
                                            <DoubleAnimation To="1.0" Storyboard.TargetName="PART_MainContainer" Storyboard.TargetProperty="Opacity" Duration="0.00:00:00.15" />
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="BarItemsPanel" >
                <Setter.Value>
                    <ItemsPanelTemplate >
                        <t:BarSeriesPanel />
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="LinearItemsPanel" >
                <Setter.Value>
                    <ItemsPanelTemplate >
                        <t:LinearSeriesPanel />
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="RadialItemsPanel" >
                <Setter.Value>
                    <ItemsPanelTemplate >
                        <t:RadialSeriesPanel />
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style>

0
Nikolay
Telerik team
answered on 10 May 2011, 07:23 AM
Hello Hannah,

Would it be possible that you send us a sample application which demonstrates this issue ( in a support ticket ) as we are unable to reproduce it locally, perhaps we are missing some of the specifics of your scenario.

Kind regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Hannah
Top achievements
Rank 1
answered on 25 Aug 2011, 11:03 PM
This was fixed in the 2011.2.712.1040 release. 

Thanks!
Tags
Chart
Asked by
Raj
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Hannah
Top achievements
Rank 1
Share this question
or