View previous topic :: View next topic |
Author |
Message |
terragile
Joined: 22 Mar 2012 Posts: 4
|
Posted: Thu Mar 22, 2012 4:24 am Post subject: Entity Framework - Exception |
|
|
I am getting a 'System.Reflection.ReflectionTypeLoadException' when trying to access entities defined in an encrypted executable.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.Data.Metadata.Edm.ObjectItemAttributeAssemblyLoader.LoadTypesFromAssembly()
at System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load()
at System.Data.Metadata.Edm.ObjectItemAttributeAssemblyLoader.Load()
at System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData)
at System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, KnownAssembliesSet knownAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage, Object& loaderCookie, Dictionary`2& typesInLoading, List`1& errors)
at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage)
at System.Data.Metadata.Edm.ObjectItemCollection.ImplicitLoadAssemblyForType(Type type, EdmItemCollection edmItemCollection)
at System.Data.Metadata.Edm.MetadataWorkspace.ImplicitLoadAssemblyForType(Type type, Assembly callingAssembly)
at System.Data.Objects.ObjectContext.GetTypeUsage(Type entityCLRType)
at System.Data.Objects.ObjectContext.GetEntitySetForNameAndType(String entitySetName, Type entityCLRType, String exceptionParameterName)
at System.Data.Objects.ObjectContext.CreateObjectSet[TEntity](String entitySetName)
at Gibraltar.Obc.Windows.GibraltarObcEntities.get_DailyRoutes()
at Gibraltar.Obc.Windows.UserControls.ucRouteList.LoadRoutes()
at Gibraltar.Obc.Windows.UserControls.ucRouteList..ctor()
at Gibraltar.Obc.Windows.frmObcWiz.InitializeComponent()
at Gibraltar.Obc.Windows.frmObcWiz..ctor()[/img] |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Mar 22, 2012 12:29 pm Post subject: |
|
|
Are the types that are being loaded by reflection defined in your main executable assembly or in sub-assemblies. Whether you can load types defined in encrypted assemblies via reflection will depend on how the loading code is implemented. If it first searches loaded assemblies for the type then you could ensure that the assembly is loaded by create a type or accessing a method defined in the assembly from your main assembly. This will force loading of the encrypted assembly.
If the reflection based loading code does its own probing and uses Assembly.LoadFrom to load the assembly then this may not work. _________________ Infralution Support |
|
Back to top |
|
|
terragile
Joined: 22 Mar 2012 Posts: 4
|
Posted: Thu Mar 22, 2012 2:35 pm Post subject: |
|
|
Thank you for the quick reply.
Everything is loaded from the main assembly so the types should be already available. I will investigate further to confirm.
Ed |
|
Back to top |
|
|
terragile
Joined: 22 Mar 2012 Posts: 4
|
Posted: Thu Mar 22, 2012 3:07 pm Post subject: |
|
|
You are right. It is trying to load an external assembly which is also encrypted.
I am going to try to merge the assemblies so they are contained in the main executable.
Ed |
|
Back to top |
|
|
|