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

XamlParseException

9 Answers 95 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ian
Top achievements
Rank 1
Ian asked on 22 Mar 2012, 11:03 AM
Hi,

The crash reporting in my app is reporting quite a few instances of a XamlParseException. I am using the DataBoundListBox in my app.

The file is identified as: Telerik.Windows.Controls.RadVirtualizingDaControl.bt(RadVirtualizingDaControlItem A_0) 

The stack trace is:
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at Telerik.Windows.Controls.RadVirtualizingDataControl.bt(RadVirtualizingDataControlItem A_0)
at Telerik.Windows.Controls.RadVirtualizingDataControl.bu(IDataSourceItem A_0, Int32 A_1)
at Telerik.Windows.Controls.RadVirtualizingDataControl.b2(IDataSourceItem A_0, Boolean A_1)
at Telerik.Windows.Controls.RadVirtualizingDataControl.b8(Boolean A_0)
at Telerik.Windows.Controls.RadVirtualizingDataControl.ManageViewport()
at Telerik.Windows.Controls.RadVirtualizingDataControl.BalanceVisualSpace()
at Telerik.Windows.Controls.RadVirtualizingDataControl.OnVerticalScrollOffsetChanged(Boolean balanceImmediately)
at Telerik.Windows.Controls.RadDataBoundListBox.OnVerticalScrollOffsetChanged(Boolean balanceImmediately)
at Telerik.Windows.Controls.RadVirtualizingDataControl.ah()
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Delegate.DynamicInvokeOne(Object[] args)
at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
at System.Windows.Threading.Dispatcher.OnInvoke(Object context)
at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at Telerik.Windows.Controls.RadVirtualizingDataControl.bt(RadVirtualizingDataControlItem A_0)
at Telerik.Windows.Controls.RadVirtualizingDataControl.bu(IDataSourceItem A_0, Int32 A_1)
at Telerik.Windows.Controls.RadVirtualizingDataControl.b2(IDataSourceItem A_0, Boolean A_1)
at Telerik.Windows.Controls.RadVirtualizingDataControl.b8(Boolean A_0)
at Telerik.Windows.Controls.RadVirtualizingDataControl.ManageViewport()
at Telerik.Windows.Controls.RadVirtualizingDataControl.BalanceVisualSpace()
at Telerik.Windows.Controls.RadVirtualizingDataControl.OnVerticalScrollOffsetChanged(Boolean balanceImmediately)
at Telerik.Windows.Controls.RadDataBoundListBox.OnVerticalScrollOffsetChanged(Boolean balanceImmediately)
at Telerik.Windows.Controls.RadVirtualizingDataControl.ah()
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Delegate.DynamicInvokeOne(Object[] args)
at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
at System.Windows.Threading.Dispatcher.OnInvoke(Object context)
at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult) 


Any ideas what may be causing this?

Thanks in advance!

9 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 22 Mar 2012, 11:58 AM
Hi Ian,

Thanks for writing and for reporting this issue.

With Q1 2012 SP1 we are introducing some changes in the layout of RadDataBoundListBoxItem and if you are using a custom style for RadDataBoundListBox and RadDataBoundListBoxItem, it might be the reason for this exception. If that's the case, could you please send us the XAML if these styles so that we can take a look and see how we can help.

Kind regards,
Deyan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ian
Top achievements
Rank 1
answered on 22 Mar 2012, 12:17 PM
Hi Deyan,

Thanks for the response.

I am not using a custom style for RadDataBoundListBox or RadDataBoundListBoxItem. However, I am using a fairly complex DataTemplate for the ItemTemplate of the list box. Could that be an issue?

Thanks
Ian
0
Deyan
Telerik team
answered on 22 Mar 2012, 12:49 PM
Hello Ian,

Theoretically the DataTemplate should not cause similar issues. Could you please paste the whole XAML page that contains the list box control so that I can take a look if there is something wrong?

Thanks for your time.

All the best,
Deyan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ian
Top achievements
Rank 1
answered on 22 Mar 2012, 01:07 PM
Hi Deyan,

I am using the DataBoundListBox inside a UserControl.  Here is the XAML for that control:

<UserControl x:Class="MyCo.WinPho7.Controls.PlayerListingsControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:svw="clr-namespace:MyCo.WinPho7.Utils.ScrollViewerWatcher;assembly=MyCo.WinPho7.Utils"
    xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
    xmlns:telerikCore="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Core"     
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">
    
    <UserControl.Resources>


        <DataTemplate x:Key="TeamPlayerMultipleViewModelTemplate">
            <Grid Margin="0,6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="64"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
            
                <Image Grid.Column="0" Source="{Binding FullMediaPath, Converter={StaticResource ImageCacheConverter}, ConverterParameter='&amp;width=64&amp;height=64'}" CacheMode="BitMapCache" Stretch="Uniform" Width="64" Height="64" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <TextBlock Grid.Column="1" Text="{Binding Player.PlayerTitle}" VerticalAlignment="Top" FontSize="26" Foreground="White" TextWrapping="NoWrap" TextTrimming="WordEllipsis" Margin="10,-6,0,0"></TextBlock>
            </Grid>
        </DataTemplate>


        <!-- Template for Listings Item -->
        <DataTemplate x:Key="TeamPlayerViewModelTemplate">
            <Grid Height="{Binding ListingHeight}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="27"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="120"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>


                <Image Grid.Column="1" Grid.Row="0" Source="{Binding AccessoryImagePath}" Height="27" Width="27" VerticalAlignment="Center"/>
                <telerikPrimitives:RadBusyIndicator AnimationStyle="AnimationStyle7" Foreground="White" Opacity="0.4" Content="" IsRunning="{Binding IsLoadingChildPlayers}" Background="Transparent" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,9,-37,0" Padding="0">
                    <telerikPrimitives:RadBusyIndicator.RenderTransform>
                        <ScaleTransform ScaleX="0.7" ScaleY="0.7" />
                    </telerikPrimitives:RadBusyIndicator.RenderTransform>
                </telerikPrimitives:RadBusyIndicator>
                <Grid Grid.Column="0" Grid.Row="0" Height="100" Margin="0,10">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="110" />
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="22"/>
                        <RowDefinition Height="22"/>
                    </Grid.RowDefinitions>


                    
                    <Image Grid.Column="0" Grid.RowSpan="3" Source="{Binding FullMediaPath, Converter={StaticResource ImageCacheConverter}, ConverterParameter='&amp;width=100&amp;height=100'}" CacheMode="BitMapCache" Stretch="Uniform" Width="100" Height="100" VerticalAlignment="Center" HorizontalAlignment="Left"/>


                    <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding ListingPlayerDisplay}" Foreground="White" FontSize="26" LineHeight="28" LineStackingStrategy="BlockLineHeight" TextWrapping="Wrap"/>


                    <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Team.TeamName}" Foreground="White" FontSize="16" TextWrapping="NoWrap" TextTrimming="WordEllipsis" />


                    <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding StadiumDisplay}" Foreground="White" FontSize="16"></TextBlock>


                </Grid>


                <ListBox Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" ItemTemplate="{StaticResource TeamPlayerMultipleViewModelTemplate}" ItemsSource="{Binding ChildPlayerViewModels}" Visibility="{Binding MultiplePlayersDisplayed, Converter={StaticResource VisibilityConverter}}" SelectedItem="{Binding SelectedPlayerViewModel, Mode=TwoWay}" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" VirtualizingStackPanel.VirtualizationMode="Recycling" telerikCore:InteractionEffectManager.IsInteractionEnabled="True">
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ListBox>
            </Grid>
        </DataTemplate>


    </UserControl.Resources>
    
    
    <Grid x:Name="LayoutRoot">


        <!-- Team Player Listings-->
        <telerikPrimitives:RadDataBoundListBox x:Name="PlayerListBox" EmptyContent="" AsyncBalanceMode="Standard" IsAsyncBalanceEnabled="True" Margin="24,0"  ItemTemplate="{StaticResource TeamPlayerViewModelTemplate}" ItemsSource="{Binding TeamListings}" SelectedItem="{Binding SelectedTeam, Mode=TwoWay}" telerikCore:InteractionEffectManager.IsInteractionEnabled="True">
        </telerikPrimitives:RadDataBoundListBox>
        
    </Grid>
</UserControl>
0
Kiril Stanoev
Telerik team
answered on 23 Mar 2012, 10:40 AM
Hello Ian,

 Unfortunately I couldn't reproduce the issue. Could you please take a look at my sample app and let me know if I am missing anything. I've removed some bindings, however this should not be an issue. 

I'd be glad to further assist you.

All the best,
Kiril Stanoev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ian
Top achievements
Rank 1
answered on 23 Mar 2012, 11:03 AM
Hi Kiril,

Thanks for the reply and the example project.

The trouble I have is that I can't reproduce this issue either! However I've had 100's of instances of this error reported via my crash reporting API from end users.

Do you have any suggestions as to how I may lower the chance of this error without knowing the true cause?

Thanks as always for the great support!

Regards
Ian


0
Kiril Stanoev
Telerik team
answered on 23 Mar 2012, 01:41 PM
Hi Ian,

Couple of things come to mind when it comes to catching issues that are not easily reproducible. First, try turning all exceptions on. 

You can turn them on through Debug > Exceptions or by pressing CTRL + ALT + E.

Secondly, you can go to Debug > Options and Settings and uncheck Enable Just My Code.



Finally, obtaining a stack trace from your end users can be really beneficial since we can pinpoint the exact place. If you have a stack trace send from a user of yours, I'd be glad to take a look at it and assist if possible.
 
Greetings,
Kiril Stanoev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ian
Top achievements
Rank 1
answered on 23 Mar 2012, 02:20 PM
Hi Kiril,

Thanks for the great suggestions about debugging. 

There is a stack trace attached to the first message in this thread... any comments are very welcome!

Thanks again

Ian
0
Deyan
Telerik team
answered on 26 Mar 2012, 08:00 AM
Hello Ian,

Thanks for writing.

Based on the stack trace we can see that the issue is related to the visual containers in RadDataBoundListBox, but we cannot exactly say what causes it. Theoretically, such exceptions are related to errors in styles or templates.

In order for us to be able to debug the case and see what goes wrong, we will need a sample project that reproduces it. Since the XAML code that you've pasted looks good at first glance, browsing through your code and directly debugging the case will be very useful.

Let me know in case you have further questions or need assistance.

All the best,
Deyan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
DataBoundListBox
Asked by
Ian
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Ian
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Share this question
or