[Mono-list] EF crashing in AssemblyName.ReferenceMatchesDefinition with is not implemented exception

mlgo mlintner at sinenomine.net
Mon Aug 26 20:44:24 UTC 2013


Has anyone figured this out yet?. Either this is going to have to be
implemented or the Entity Framwork needs to avoid calling it. There is a
stacktrace at the bottom of this message. 

System.Reflection.AssemblyName.ReferenceMatchesDefinition is not
implemented. I guess developers have been working around this by comparing
the assembly fullnames. Since it is called directly by EntityFramework it
has to be implemented now. Unless EF should be changed to avoid this call.
This is something I have not researched either. If anyone would think that
EntityFramework should be changed to avoid making this call please add some
feedback. 

Has anyone done this implementation or are they working on it currently?. I
don't see any posts or bugs relating to it but I did find one reference to
the problem in the context of another product using mono.
Does the mono team plan to or want to implement it?


I have done some research on this method in dotnet. The implementation for
windows as documented by MSDN in this simple way "The comparison depends
only on the simple assembly name. It ignores version, culture, and public
key token. ". 

At a more fundamentally level the purpose of this method is to determine if
the 2 names resolve to the same assembly. I believe that the documentation
in dotnet used to read that way and referred to the loader. I suspect that
dotnet is still doing that as part of the implementation of this function.
If that approach were taken I'm not yet sure if it requires making windows
OS calls to do it or if it could be done with managed code. The point is if
it does need to be done and it needs to call os api's then the
implementation would need to be different for Linux. If it is called often.
If it involves loading an assembly using both of the names and then
determining whether it is the same assembly that seems slow and inefficient.
I have not done any performance profiling on this call to find out often it
gets called.  
I think I would want to cache the assemblies. Also memoize the assembly
names and their results. This would speed things up considerably. 

 

I'm concerned this will need to be implemented differently on Linux?? Hence
it will have multiple implementations.

Now that EF6 is in and people are using this becomes an immediate problem as
it binds directly to the unimplemented function
AssemblyName.ReferenceMatchesDefinition. Here is the stack:

 

System.NotImplementedException: The requested feature is not implemented.

  at System.Reflection.AssemblyName.ReferenceMatchesDefinition
(System.Reflection.AssemblyName reference, System.Reflection.AssemblyName
definition) [0x0003a] in
C:\cygwin\sources\mono\mcs\class\corlib\System.Reflection\AssemblyName.cs:328 

  at
System.Data.Entity.Core.Metadata.Edm.DefaultAssemblyResolver.ResolveAssembly
(System.Reflection.AssemblyName referenceName) [0x00019] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Metadata\Edm\DefaultAssemblyResolver.cs:30 

  at
System.Data.Entity.Core.Metadata.Edm.DefaultAssemblyResolver.TryResolveAssemblyReference
(System.Reflection.AssemblyName refernceName, System.Reflection.Assembly&
assembly) [0x00000] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Metadata\Edm\DefaultAssemblyResolver.cs:14 

  at
System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderCompositeResource.ResolveAssemblyName
(System.String assemblyName,
System.Data.Entity.Core.Metadata.Edm.MetadataArtifactAssemblyResolver
resolver) [0x00007] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Metadata\Edm\MetadataArtifactLoaderCompositeResource.cs:272 

  at
System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader
(System.String path, ExtensionCheck extensionCheck, System.String
validExtension, ICollection`1 uriRegistry,
System.Data.Entity.Core.Metadata.Edm.MetadataArtifactAssemblyResolver
resolver) [0x0004d] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Metadata\Edm\MetadataArtifactLoaderCompositeResource.cs:306 

  at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader.Create
(System.String path, ExtensionCheck extensionCheck, System.String
validExtension, ICollection`1 uriRegistry,
System.Data.Entity.Core.Metadata.Edm.MetadataArtifactAssemblyResolver
resolver) [0x0000b] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Metadata\Edm\MetadataArtifactLoader.cs:91 

  at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader.Create
(System.String path, ExtensionCheck extensionCheck, System.String
validExtension, ICollection`1 uriRegistry) [0x00000] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Metadata\Edm\MetadataArtifactLoader.cs:61 

  at System.Data.Entity.Core.Metadata.Edm.MetadataCache.SplitPaths
(System.String paths) [0x0011b] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Metadata\Edm\MetadataCache.cs:176 

  at
System.Data.Entity.Core.Common.Utils.Memoizer`2+<Evaluate>c__AnonStorey14D[System.String,System.Collections.Generic.List`1[System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader]].<>m__168
() [0x00000] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Common\Utils\Memoizer.cs:58 

  at
System.Data.Entity.Core.Common.Utils.Memoizer`2+Result[System.String,System.Collections.Generic.List`1[System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader]].GetValue
() [0x00035] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Common\Utils\Memoizer.cs:134 

  at
System.Data.Entity.Core.Common.Utils.Memoizer`2[System.String,System.Collections.Generic.List`1[System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader]].Evaluate
(System.String arg) [0x0007f] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Common\Utils\Memoizer.cs:70 

  at
System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetOrCreateMetdataArtifactLoader
(System.String paths) [0x00000] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Metadata\Edm\MetadataCache.cs:298 

  at
System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace
() [0x00041] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\EntityClient\EntityConnection.cs:433 

  at
System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection
() [0x00017] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Objects\ObjectContext.cs:1746 

  at System.Data.Entity.Core.Objects.ObjectContext..ctor
(System.Data.Entity.Core.EntityClient.EntityConnection connection, Boolean
isConnectionConstructor,
System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory
objectQueryExecutionPlanFactory,
System.Data.Entity.Core.Common.Internal.Materialization.Translator
translator, System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory
columnMapFactory, IDbCommandInterceptor commandInterceptor) [0x000cb] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Objects\ObjectContext.cs:210 

  at System.Data.Entity.Core.Objects.ObjectContext..ctor (System.String
connectionString) [0x00000] in
C:\cygwin\sources\mono\external\entityframework\src\EntityFramework\Core\Objects\ObjectContext.cs:132 

  at System.Data.Entity.Core.Objects.ObjectContext..ctor (System.String
connectionString, System.String defaultContainerName) 

This part of the stack removed.




--
View this message in context: http://mono.1490590.n4.nabble.com/EF-crashing-in-AssemblyName-ReferenceMatchesDefinition-with-is-not-implemented-exception-tp4660659.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list