Databinding error with a shared interface
Asked Answered
I

1

6

Hey I wonder if someone could help me. I try to bind my imported test modules to my view, see below for code:

<UserControl x:Class="AvanadeTT.Controls.Views.Module"
    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:ignore="http://www.ignore.com"
    xmlns:local="clr-namespace:InterfaceLibrary;assembly=InterfaceLibrary"
    mc:Ignorable="d ignore"
    Height="600" Width="600">
     <Grid>
      <TreeView Name="ModuleTV">
        <TreeView.Resources>
            <HierarchicalDataTemplate  DataType="{x:Type local:ITestTest}"        ItemsSource="{Binding Modules}" >
                <TextBlock Text="{Binding Name}"/>
            </HierarchicalDataTemplate>
            <HierarchicalDataTemplate  DataType="{x:Type local:ITestTest}" ItemsSource="{Binding Author}" >
                <TextBlock Text="{Binding Name}"/>
            </HierarchicalDataTemplate>
        </TreeView.Resources>
    </TreeView>
        <Button Content="OK" HorizontalAlignment="Left" Margin="488,534,0,0"     VerticalAlignment="Top" Width="94" Height="31"/>
    </Grid>
</UserControl>

Now my viewmodel does get the data so that is not what the problem is. The editor gives the following stacktrace and error:

'Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception.' Line number '13' and line position '14'. 

The fusionlog shows this content:

=== Pre-bind state information ===
LOG: User = -------
LOG: DisplayName = InterfaceLibrary, PublicKeyToken=f004634844582dd6
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: InterfaceLibrary, PublicKeyToken=f004634844582dd6 | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\STEPHE~1.MAC\AppData\Local\Temp\dev4FB3.tmp
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/InterfaceLibrary/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/InterfaceLibrary/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/InterfaceLibrary/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/InterfaceLibrary/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/InterfaceLibrary/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/InterfaceLibrary/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/InterfaceLibrary/InterfaceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/InterfaceLibrary/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/InterfaceLibrary/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/InterfaceLibrary/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/InterfaceLibrary/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/InterfaceLibrary/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/InterfaceLibrary/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/InterfaceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/InterfaceLibrary/InterfaceLibrary.EXE.

Good to know maybe is that my Interface definition is a shared assembly, this because I import via the MEF framework.

My InterfaceLibrary is being copied to my debug folder and this also shows there.

Inga answered 26/3, 2013 at 14:20 Comment(2)
Try to strong name the assembly and add it to the GAC.Verbenaceous
The assembly is strongly named, it's added to the GAC dynamicly. So that isn't the problem. Thanks for your respondingInga
A
0

The error says that your problem is line 13. I would be surprised if your ItemsSource binding was the problem. I would guess that there's some sort of problem finding the ITestTest type. I couldn't tell you why.

Anchovy answered 8/4, 2013 at 19:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.