Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Entity Framework - Exception

 
Post new topic   Reply to topic    Infralution Support Forum Index -> .NET Encryptor Support
View previous topic :: View next topic  
Author Message
terragile



Joined: 22 Mar 2012
Posts: 4

PostPosted: Thu Mar 22, 2012 4:24 am    Post subject: Entity Framework - Exception Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Mar 22, 2012 12:29 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
terragile



Joined: 22 Mar 2012
Posts: 4

PostPosted: Thu Mar 22, 2012 2:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
terragile



Joined: 22 Mar 2012
Posts: 4

PostPosted: Thu Mar 22, 2012 3:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> .NET Encryptor Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group