謎のTypeLoadException
ViewModel生成のテストをしているのだが、原因不明のエラーに悩まされている。
以下のXAMLにより直接ViewModelのインスタンスを生成してビューのDataContextにセットしているのだが、
エラーの詳細
System.TypeLoadException アセンブリ 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' から型 'System.ComponentModel.IDataErrorInfo' を読み込めませんでした。 場所 System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) 場所 System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) 場所 System.Reflection.Assembly.GetType(String name) 場所 Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetRuntimeType(Type type) 場所 Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.TryGetRuntimeType() 場所 Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.EnsureRuntimeType(Type type) 場所 Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider.GetRuntimeType(Type reflectionType) 場所 MS.Internal.Package.VSIsolationProviderService.RemoteReferenceProxy.VsReflectionResolver.GetRuntimeType(Type reflectionType) 場所 Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.CachingReflectionResolver.GetRuntimeType(Type reflectionType) 場所 Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.Microsoft.Windows.Design.Metadata.IReflectionResolver.GetRuntimeType(Type reflectionType) 場所 MS.Internal.Metadata.ClrType.get_RuntimeMember() 場所 MS.Internal.Metadata.ClrMember`1.Microsoft.Windows.Design.Metadata.Reflection.IReflectionMember.get_MemberInfo() 場所 Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.IsAssignableFrom(ITypeMetadata requesting, ITypeMetadata target) 場所 Microsoft.Windows.Design.Platform.SilverlightMetadataContext.IsAssignableFrom(ITypeMetadata requesting, ITypeMetadata target) 場所 MS.Internal.Metadata.ClrType.IsAssignableFrom(ITypeMetadata type) 場所 MS.Internal.Metadata.WrapperType.IsAssignableFrom(ITypeMetadata type) 場所 MS.Internal.Design.Metadata.ReflectionTypeNode.IsAssignableTo(TypeNode type) 場所 MS.Internal.Design.Markup.XamlElement.ValidateChildren(IParseContext context, Dictionary`2 setProperties) 場所 MS.Internal.Design.Markup.XamlPropertyElement.Validate(IParseContext context) 場所 MS.Internal.Design.Markup.XamlObjectElement.ValidatePropertyElement(IParseContext context, Dictionary`2 setProperties, XamlPropertyElement propertyElement) 場所 MS.Internal.Design.Markup.XamlElement.ValidateChildren(IParseContext context, Dictionary`2 setProperties) 場所 MS.Internal.Design.Markup.XamlObjectElement.Validate(IParseContext context) 場所 MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean convertToXamlWithErrors) 場所 MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem() 場所 Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem() 場所 Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState() 場所 MS.Internal.Host.PersistenceSubsystem.Load() 場所 MS.Internal.Host.Designer.Load() 場所 MS.Internal.Designer.VSDesigner.Load() 場所 MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load() 場所 MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view) 場所 MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view) 場所 MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view) 場所 MS.Internal.Host.Isolation.IsolatedDesigner.Load() 場所 MS.Internal.Designer.DesignerPane.LoadDesignerView(Boolean isReload)
しかしこれはデザイン時の問題のようで、ここからアプリケーションを起動してエミュレータ側で実行すると同様の問題は発生しない。
また、"System.ComponentModel.IDataErrorInfo"がロードできないということだが、Blend4で同XAMLを読込むとエラーが変わる。