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

Bug in internal build: 2010.3.1331.40

3 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Arnstein
Top achievements
Rank 1
Arnstein asked on 03 Feb 2011, 10:19 AM
Hi, we're getting this exception when updating to v. 2010.3.1331.40 in the RadGridView control:
 
System.Reflection.TargetInvocationException was unhandled
  Message=Property accessor 'C' on object 'RadControlsWpfApp2.A' threw the following exception:'Object does not match target type.'

It seems like the problem is related to the number of sublevels in the DataMemberBinding. In the example below the binding of the first column works, but the second column fails.

To recreate the exception:

<Window x:Class="RadControlsWpfApp2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <telerik:RadGridView
            ItemsSource="{Binding Items}"
            AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=B.Id}" Header="Works" ></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=B.C.Name}" Header="Fails" ></telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>
namespace RadControlsWpfApp2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            var model = new Model();
            DataContext = model;
        }
    }
}
using System.Collections.Generic;

namespace RadControlsWpfApp2
{
    class Model
    {
        public Model()
        {
            Items = new List<A> {new A(), new A()};
        }
        public IList<A> Items { getset; }
    }

    class A
    {
        public A()
        {
            B = new B();
        }
        public B B { getset; }
    }
    class B
    {
        public B()
        {
            C = new C();
            Id = "3213123";
        }

        public string Id { getset; }
        public C C { getset; }
    }
    class C
    {
        public C()
        {
            Name = "Test";
        }
        public string Name { getset; }
    }
}


And here is the exception details:
System.Reflection.TargetInvocationException was unhandled
  Message=Property accessor 'C' on object 'RadControlsWpfApp2.A' threw the following exception:'Object does not match target type.'
  Source=System
  StackTrace:
       at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
       at Telerik.Windows.Data.PropertyPathDescriptor.GetPropertyOwnerValue(Object parentObject) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Core\Data\ItemProperties\PropertyPathDescriptor.cs:line 161
       at Telerik.Windows.Controls.GridView.GridViewCell.GetDataErrors() in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 614
       at Telerik.Windows.Controls.GridView.GridViewCell.UpdateIsValidState() in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 588
       at Telerik.Windows.Controls.GridView.GridViewCell.UpdateValue() in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 1358
       at Telerik.Windows.Controls.GridView.GridViewCell.OnColumnChanged(GridViewColumn oldColumn, GridViewColumn newColumn) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 1341
       at Telerik.Windows.Controls.GridView.GridViewCellBase.set_Column(GridViewColumn value) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCellBase.cs:line 160
       at Telerik.Windows.Controls.GridView.DataCellsPresenter.PrepareContainerForItemOverride(DependencyObject element, Object item) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\DataCellsPresenter.cs:line 261
       at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
       at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 889
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertNewContainer(Int32 childIndex, UIElement container) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 808
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 791
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, GridViewColumn column, Int32& childIndex, Size& childSize) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 703
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, GridViewColumn column, IDisposable& generatorState, Int32& childIndex, Size& childSize) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 681
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.DetermineRealizedColumnsBlockList(Size constraint) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 412
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size constraint) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 80
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at Telerik.Windows.Controls.GridView.GridViewRowItem.MeasureOverride(Size constraint) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Rows\GridViewRowItem.cs:line 169
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size constraint) in c:\Builds\WPF_Scrum\HotFix_2010_Q3\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewVirtualizingPanel.cs:line 1269
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.UIElement.UpdateLayout()
       at System.Windows.Interop.HwndSource.SetLayoutSize()
       at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
       at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
       at System.Windows.Window.SetRootVisual()
       at System.Windows.Window.SetRootVisualAndUpdateSTC()
       at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
       at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
       at System.Windows.Window.CreateSourceWindowDuringShow()
       at System.Windows.Window.SafeCreateWindowDuringShow()
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at RadControlsWpfApp2.App.Main() in c:\users\arnvol\documents\visual studio 2010\Projects\RadControlsWpfApp2\RadControlsWpfApp2\obj\x86\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Reflection.TargetException
       Message=Object does not match target type.
       Source=mscorlib
       StackTrace:
            at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
            at System.SecurityUtils.MethodInfoInvoke(MethodInfo method, Object target, Object[] args)
            at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
       InnerException:

Regards,
Arnstein

3 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 03 Feb 2011, 02:10 PM
Hello Arnstein,

Thank you for reporting this out. The problem is fixed and will be available with the next latest internal build.
Sorry for the inconvenience caused.

P.S. I've updated your Telerik points accordingly.

Best wishes,
Nedyalko Nikolov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Ralf
Top achievements
Rank 1
answered on 03 Feb 2011, 03:52 PM
Hi Nedyalko,

until when will the next internal build be available?

Ijust spent today too much time searching for the same error ;)

thanks

Ralf
0
Nedyalko Nikolov
Telerik team
answered on 03 Feb 2011, 04:11 PM
Hi Ralf,

We upload latest internal assemblies every Monday, so the next latest internal build should be available on 7-th Feb.

All the best,
Nedyalko Nikolov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
Arnstein
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Ralf
Top achievements
Rank 1
Share this question
or