3

Closed

EF fails when a winmd assembly is referenced

description

Closed Mar 15, 2013 at 4:42 PM by mgirgin

comments

moozzyk wrote Oct 23, 2012 at 12:05 AM

After adding a reference to the Windows.winmd assembly EF does not handle an exception from Assembly.Load what causes a crash. EF tries to load the assembly to check if it contains pre-generated views. EF should not fail but ignore the failure and carry on. Relevant part of the stack trace:

HResult=-2146233067
        Message=Could not load file or assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) 
        Source=mscorlib 
        FileName=Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime 
        FusionLog="" 
        StackTrace: 
             at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
             at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
             at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
             at System.Reflection.Assembly.Load(AssemblyName assemblyRef) 
             at System.Data.Metadata.Edm.MetadataAssemblyHelper.SafeLoadReferencedAssembly(AssemblyName assemblyName) 
             at System.Data.Metadata.Edm.MetadataAssemblyHelper.<GetNonSystemReferencedAssemblies>d__0.MoveNext() 
             at System.Data.Metadata.Edm.ObjectItemCollection.ImplicitLoadViewsFromAllReferencedAssemblies(Assembly assembly) 
             at System.Data.Mapping.StorageMappingItemCollection.ViewDictionary.SerializedCollectViewsFromReferencedAssemblies(MetadataWorkspace workspace, Dictionary`2 extentMappingViews) 
             at System.Data.Mapping.StorageMappingItemCollection.ViewDictionary.SerializedGetGeneratedViews(EntityContainer container) 
             at System.Data.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0() 
             at System.Data.Common.Utils.Memoizer`2.Result.GetValue() 
             at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg) 
             at System.Data.Mapping.StorageMappingItemCollection.ViewDictionary.GetGeneratedView(EntitySetBase extent, MetadataWorkspace workspace, StorageMappingItemCollection storageMappingItemCollection) 
             at System.Data.Metadata.Edm.MetadataWorkspace.GetGeneratedView(EntitySetBase extent) 
             at System.Data.Query.PlanCompiler.PreProcessor.ExpandView(Node node, ScanTableOp scanTableOp, IsOfOp& typeFilter) 
             at System.Data.Query.PlanCompiler.PreProcessor.ProcessScanTable(Node scanTableNode, ScanTableOp scanTableOp, IsOfOp& typeFilter) 
             at System.Data.Query.PlanCompiler.PreProcessor.Visit(ScanTableOp op, Node n) 
             at System.Data.Query.InternalTrees.ScanTableOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n) 
             at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n) 
             at System.Data.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n) 
             at System.Data.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(RelOp op, Node n) 
             at System.Data.Query.PlanCompiler.PreProcessor.Visit(ProjectOp op, Node n) 
             at System.Data.Query.InternalTrees.ProjectOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n) 
             at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n) 
             at System.Data.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n) 
             at System.Data.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(RelOp op, Node n) 
             at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.VisitSortOp(SortBaseOp op, Node n) 
             at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.Visit(ConstrainedSortOp op, Node n) 
             at System.Data.Query.InternalTrees.ConstrainedSortOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n) 
             at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n) 
             at System.Data.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(Node n) 
             at System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitDefault(Node n) 
             at System.Data.Query.InternalTrees.BasicOpVisitorOfNode.VisitPhysicalOpDefault(PhysicalOp op, Node n) 
             at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.Visit(PhysicalProjectOp op, Node n) 
             at System.Data.Query.InternalTrees.PhysicalProjectOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n) 
             at System.Data.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n) 
             at System.Data.Query.PlanCompiler.PreProcessor.Process(Dictionary`2& tvfResultKeys) 
             at System.Data.Query.PlanCompiler.PreProcessor.Process(PlanCompiler planCompilerState, StructuredTypeInfo& typeInfo, Dictionary`2& tvfResultKeys) 
             at System.Data.Query.PlanCompiler.PlanCompiler.Compile(List`1& providerCommands, ColumnMap& resultColumnMap, Int32& columnCount, Set`1& entitySets) 
             at System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)

RoMiller wrote Jan 16, 2013 at 8:17 PM

Need more info, did we consistently repro this?

myCollections wrote Feb 14, 2013 at 6:08 AM

Hello RoMiller,

Yes i can reproduce it. I can, send you a small project to reproduce it if needded.

Thanks for your time.

moozzyk wrote Feb 27, 2013 at 5:46 PM

@myCollections - a repro project would be very useful

myCollections wrote Mar 1, 2013 at 9:33 AM

@moozzyk : Hello, i just send you a mail with a link to the project. Thanks.

moozzyk wrote Mar 11, 2013 at 9:34 PM

Fixed in changeset 50c1e5a2c46d

myCollections wrote Mar 11, 2013 at 9:58 PM

@moozzyk : Thanks a lot :)