Community & Support
Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Chart > 3D-Chart crashes but 2D works...

Not answered 3D-Chart crashes but 2D works...

Feed from this thread
  • Dimitrij Wolf avatar

    Posted on Oct 12, 2009 (permalink)

    Hi,

    i try to render WPF content with telerik chart-controls in VB6. This is possible if you are using the Microsoft Interop Forms Toolkit (http://msdn.microsoft.com/en-us/vbasic/bb419144.aspx). If i'm using the 2D controls everiting is fine. But if I switch to 3D I get a OutOfMemoryException or NullReferenceException.

    Here is my XAML:
    <UserControl x:Class="UserControl1" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:charts="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting">  
        <Grid> 
            <charts:RadChart x:Name="MyChart"/>  
        </Grid> 
    </UserControl> 
     

    This is the code-behind from the 2D version:
        Public Sub New()  
     
            ' This call is required by the Windows Form Designer.  
            InitializeComponent()  
     
            ' Add any initialization after the InitializeComponent() call.  
            MyChart.DefaultSeriesDefinition = New BarSeriesDefinition  
     
            Dim itemSource As Double() = {5, 9, 17, 10, 11, 3, 12}  
            MyChart.ItemsSource = itemSource  
     
        End Sub 
     

    And here is the code-behind from the 3D version:
        Public Sub New()  
     
            ' This call is required by the Windows Form Designer.  
            InitializeComponent()  
     
            ' Add any initialization after the InitializeComponent() call.  
            MyChart.DefaultSeriesDefinition = New Bar3DSeriesDefinition  
     
            Dim itemSource As Double() = {5, 9, 17, 10, 11, 3, 12}  
            MyChart.ItemsSource = itemSource  
     
            AddHandler MyChart.DefaultView.ChartArea.Loaded, AddressOf Me.RadChart_Loaded  
     
        End Sub 
     
        Private Sub RadChart_Loaded(ByVal sender As ObjectByVal e As RoutedEventArgs)  
     
            Dim camera As New CameraExtension  
            camera.SpinAxis = SpinAxis.XY  
            camera.ZoomEnabled = True 
     
            MyChart.DefaultView.ChartArea.Extensions.Add(camera)  
     
        End Sub 

    The same code works in a normal .NET-project and also in a WinForms-project on the ElementHost.

    Best regards,
    Dimi

    Reply

  • Bartholomeo Rocca Master avatar

    Posted on Oct 15, 2009 (permalink)

    Hello Dimi,

    This is one exotic setup you have here. It seems quite odd that your managed application is crashing with different kinds of exceptions on consecutive runs (NullReferenceException vs OutOfMemoryException). Also, as you have noted the same setup works seamlessly on the officially supported platforms (pure WPF setup and WinForms-hosted one) so I would suspect there is some problem with this particular toolkit when rendering 3D content. Have you verified the toolkit is capable of rendering generic WPF 3D content at all?


    Greetings,
    Bart.

    Reply

  • Q1 Webinar Week
  • Dimitrij Wolf avatar

    Posted on Oct 15, 2009 (permalink)

    Hello Bart,

    the toolkit has no problems with other 3D staff. Everything I've tested works well. It only crashes with the 3D-charts.

    Best regards,
    Dimi

    Reply

  • Dimitrij Wolf avatar

    Posted on Feb 4, 2010 (permalink)

    Hello Everyone,

    I've solved the problem above. The .NET-Framework can't find the "Telerik.Windows.Controls.Charting.dll" in my setup. It works only if you put the assembly in the gac or if you're using the following methods at the beginning of your program (before using any chart):

        Private Sub LoadDependentAssemblies()  
            Try 
                Dim currentDomain As AppDomain = AppDomain.CurrentDomain  
     
                AddHandler currentDomain.AssemblyResolve, AddressOf MyResolveEventHandler  
     
                InstantiateTelerikAssemblies(currentDomain)  
     
                RemoveHandler currentDomain.AssemblyResolve, AddressOf MyResolveEventHandler  
            Catch ex As Exception  
                'some error handling...  
            End Try 
        End Sub 
     
        Private Sub InstantiateTelerikAssemblies(ByVal domain As AppDomain)  
            Try 
                ' create a dummy instance  
                domain.CreateInstance("Telerik.Windows.Controls.Charting, Version=2009.3.1208.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7""Telerik.Windows.Controls.RadChart")  
            Catch e As Exception  
            End Try 
        End Sub 
     
        Private Function MyResolveEventHandler(ByVal sender As ObjectByVal args As ResolveEventArgs) As [Assembly]  
            Dim assemblyPath as String = "[the path of the assembly]" 
            Return Assembly.LoadFrom(assemblyPath & "Telerik.Windows.Controls.Charting.dll"))  
        End Function 
     

    Best regards,
    Dimi

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Chart > 3D-Chart crashes but 2D works...
Related resources for "3D-Chart crashes but 2D works..."

WPF Chart Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]