This is a migrated thread and some comments may be shown as answers.

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

10 Answers 2410 Views
Installer and VS Extensions
This is a migrated thread and some comments may be shown as answers.
Timothy Kruszewski
Top achievements
Rank 1
Timothy Kruszewski asked on 21 Jul 2010, 12:31 AM
I've been getting the error below on my production server only ever since I upgraded to the RADControls for ASP.NET Q2 release, file version 2010,2,713,40.  By adding the try/catch below I was able to indetify what assembly was causing the error

 "Could not load file or assembly 'Telerik.Web.UI, Version=2010.1.519.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

The problem is this assembly version does not exist on either my dev or production environment.  This happens everytime I make an update to my prod box and I can usually resolve it by resetting the app pool or resetting IIS but it doesn't always work the first time.  All of my projects are set up under the 4.0 framework and I've cleaned the solution several times but the issue persists.  Also, this error only occurs on pages that use the Entity Framwork to databind.  Any help would be greatly appreciated,

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
Exception Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
  
Source Error: 
  
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
  
Stack Trace: 
  
  
[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0
   System.Reflection.RuntimeModule.GetTypes() +4
   System.Reflection.Assembly.GetTypes() +78
   System.Data.Metadata.Edm.ObjectItemConventionAssemblyLoader.LoadTypesFromAssembly() +32
   System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load() +25
   System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData) +160
   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) +166
   System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage) +316
   System.Data.Metadata.Edm.ObjectItemCollection.ExplicitLoadFromAssembly(Assembly assembly, EdmItemCollection edmItemCollection, Action`1 logLoadMessage) +53
   System.Data.Metadata.Edm.MetadataWorkspace.ExplicitLoadFromAssembly(Assembly assembly, ObjectItemCollection collection, Action`1 logLoadMessage) +93
   System.Data.Metadata.Edm.MetadataWorkspace.LoadFromAssembly(Assembly assembly, Action`1 logLoadMessage) +130
   System.Web.UI.WebControls.EntityDataSourceView.ConstructContext() +585
   System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +76
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
  
  

try
       {       
           RadScheduler1.DataSource = TED.BLL.Appointment.Appointments(SafeValue.SafeInt(ddlView.SelectedValue),SafeValue.SafeInt(ddlCategory.SelectedValue),SafeValue.SafeInt(ddlClientName.SelectedValue),Users,RadScheduler1.VisibleRangeStart, RadScheduler1.VisibleRangeEnd);
           RadScheduler1.DataKeyField = "ID";
           RadScheduler1.DataStartField = "Start";
           RadScheduler1.DataEndField = "End";
           RadScheduler1.DataSubjectField = "Subject";
           RadScheduler1.DataDescriptionField = "Description";
           RadScheduler1.DataRecurrenceParentKeyField = "RecurrenceParentID";
           RadScheduler1.DataRecurrenceField = "RecurrenceRule";
           RadScheduler1.DataBind();
       }
       catch (Exception ex)
       {
           ReflectionTypeLoadException exception = ex as ReflectionTypeLoadException;
           if (exception == null)
           {
               using (TextWriter tw = new StreamWriter(Server.MapPath("~/Scheduler/EDSLog.txt")))
               {
                   tw.WriteLine("Not a ReflectionTypeLoadException ex.");
               }
           }
           else
           {
               foreach (Exception loaderException in exception.LoaderExceptions)
               {
                   using (TextWriter tw = new StreamWriter(Server.MapPath("~/Scheduler/EDSLog.txt")))
                   {
                       tw.WriteLine(loaderException.Message);
                       tw.WriteLine(loaderException.StackTrace);
                   }
               }
           }
       }

10 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 27 Jul 2010, 12:56 PM
Hi Timothy,

Thank you for the detailed problem report.

I couldn't reproduce this error in test environment, but it looks like you're not the only one who gets this error.

What are the chances that you have another application that runs in the same application pool and uses the Telerik assembly? Have you tried creating a new application pool exclusively for the problematic application?

I hope this helps.

All the best,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Timothy Kruszewski
Top achievements
Rank 1
answered on 27 Jul 2010, 09:35 PM
I have verified that each application on the server has it's own application pool and this is the error captured when loading my page with the Telerik Schdeduler.

Could not load file or assembly 'Telerik.Web.UI, Version=2010.1.309.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
0
T. Tsonev
Telerik team
answered on 03 Aug 2010, 03:53 PM
Hi Timothy,

I've spent some more time trying to reproduce the problem, but without success.

Maybe I'll have more luck with a stripped-down version of your project. Also, let me know under what version of IIS you're testing.

Another thing that you might try in the meantime is to deploy the Telerik.Web.UI assembly in the GAC. One of the comments at SO suggests that this might help.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
easten
Top achievements
Rank 1
answered on 21 Dec 2010, 04:44 AM
the problem only occured when you bind the entitydatasource with some control in the design mode.
the work around is try not to use entitydatasource. bind the entity with control through code behind.

firstly, i never get this kind of error in my previous project, so after i got this kind of problem, i try to compare it to my old app.
all the config and setting are the same. but i realize the problem occured after i install some additional feature for my telerik (i'm installing telerik winform)
after some research, finally i found that some reference have brought up the problem.
therefore, i try to remove several unused reference such as wpf,silverlight, etc.
after i remove those reference my app work smoothly.
(but i am curious why this kind of error could happen, actually the reference are the same with my previous app, maybe some assembly getting wrong after the installation)

hope this help.
0
Timothy Kruszewski
Top achievements
Rank 1
answered on 21 Dec 2010, 10:56 PM
In my case I needed to delete all of the dll's from my working directory on my production server. 
0
Dan
Top achievements
Rank 1
answered on 01 Mar 2011, 10:33 PM


Hi,


I just found this link on the Microsoft Connect site: 
http://connect.microsoft.com/VisualStudio/feedback/details/541962/unable-to-load-one-or-more-of-the-requested-types-connected-with-entitydatasource


What finally did it for me was adding a ContextTypeName value to my EntityDataSource(s). For example, ContextTypeName="Employees.Data_Access.dbEmployeesEntities".


Hope this helps,

Dan

0
Barbaros Saglamtimur
Top achievements
Rank 1
answered on 18 Apr 2011, 02:35 PM
In my case my development (working copy) server is 2008 R2 without Server ServicePack 1 and production server is with ServicePack1. So for a quick solution I configure every system references as "CopyLocal = true" and copy dlls to bin folder, and works. Another solution might be binding data at run time not with entitydatasource. I will try this later. So, in my case this is not a telerik related problem.
0
Dan
Top achievements
Rank 1
answered on 14 Mar 2012, 09:06 PM
Dan, 
Your solution worked for me.

Alex
0
Michael Nourani
Top achievements
Rank 1
answered on 05 Jan 2015, 06:33 PM
I know this is a very old issue. But I ran into it last night during a deployment and kept me up late.

This Error usually refers to lines of code, totally unrelated to the missing type.

The ERROR simply refers to inability to cycle through the type definition and it can happen during any call which requires type lookup in assemblies, in my case it was the first LINQ to SQL query in the app.

I was missing some of the  Telerik.Reporting dlls.

The reason it work in DEV environment, is because the types are loaded in the GAC and are accessible.

Also see <a heref="http://stackoverflow.com/questions/1091853/error-message-unable-to-load-one-or-more-of-the-requested-types-retrieve-the-l"> this post </a>

0
Prasad
Top achievements
Rank 1
answered on 28 Mar 2016, 10:45 AM

One solution that worked for me was to delete the bin/ and obj/ folders and rebuild the solution.

and insert Kendo.mvc.dll & KendoGridBinderEx.dll again, it will work

Tags
Installer and VS Extensions
Asked by
Timothy Kruszewski
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Timothy Kruszewski
Top achievements
Rank 1
easten
Top achievements
Rank 1
Dan
Top achievements
Rank 1
Barbaros Saglamtimur
Top achievements
Rank 1
Dan
Top achievements
Rank 1
Michael Nourani
Top achievements
Rank 1
Prasad
Top achievements
Rank 1
Share this question
or