TargetException error in Binding to Dictionary<string, object> - by Michael Lemley

Status : 

  External<br /><br />
		This item may be valid but belongs to an external system out of the direct control of this product team.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


19
0
Sign in
to vote
ID 750518 Comments
Status Closed Workarounds
Type Bug Repros 7
Opened 6/22/2012 1:51:58 PM
Access Restriction Public

Description

I have an CLR object with a CLR property of type Dictionary<string, object> 

I attempt to display the property with the XAML:
 <ListView ItemsSource="{Binding MyDictionaryProperty}">
   <ListView.ItemTemplate>
      <DataTemplate >
         <StackPanel>
            <TextBlock Text="{Binding}"/>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding Key}"/>
               <TextBlock Text=": "/>
               <TextBlock Text="{Binding Value}"/>
            </StackPanel>
         </StackPanel>
      </DataTemplate>
   </ListView.ItemTemplate>
</ListView> 
The {Binding} statement resolves to the name of the object:
 
System.Runtime.InteropServices.WindowsRuntime.CLRIKeyValuePairImp['2[System.String,System.Object]
 
So I know I have my binding statement defined correctly.
 
However, the Key and Value statements result in the following errors in Visual Studio debug output below. Is there a workaround for this problem?

An exception of type 'System.Reflection.TargetException' occurred in mscorlib.dll and wasn't handled before a managed/native boundary
** details in Actual Results ** 


Note: originally posted on http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/234a17ad-975f-42f6-aa91-7212deda4190
Sign in to post a comment.
Posted by StonyUK on 2/26/2013 at 10:15 AM
This is occurring on Windows 8 with Visual Studio 2012 as well.
Posted by Microsoft on 7/2/2012 at 12:11 AM
Thank you for your bug submission. The issue you reported appears to be a Windows issue, and we have forwarded the bug to them. We will close the bug in Connect, as they have now received it in their internal database, and they will evaluate it for the product. If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to http://support.microsoft.com <http://support.microsoft.com/> or call 1-800-MICROSOFT for assistance. For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.

Other Support links - http://support.microsoft.com/ph/14019#tab13
Posted by Microsoft on 6/25/2012 at 2:15 AM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 6/22/2012 at 2:50 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)