More in this section

Forums / Bugs & Issues / After 4.1 upgrade, site fails with ReflectionTypeLoadException

After 4.1 upgrade, site fails with ReflectionTypeLoadException

14 posts, 0 answered
  1. Adam
    Adam avatar
    17 posts
    Registered:
    26 Feb 2009
    18 Apr 2011
    Link to this post
    I followed the upgrade instructions from 4.0 SP1 to 4.1 step by step and after the upgrade completed, now my site crashes with this error:

    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.]
       DynamicModule.ns.Wrapped_OpenAccessMetaDataProvider_1c10a2046d1a4be1999dd8558ba64d43.Initialize(String providerName, NameValueCollection config, Type managerType) +405
       Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, Type providerType, ExceptionPolicyName policy, ManagerBase`1 manager) +2211
       Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, ExceptionPolicyName policy, ManagerBase`1 manager) +74
       Telerik.Sitefinity.Data.ManagerBase`1.SetProvider(String providerName, String transactionName) +214
    
    [TargetInvocationException: Exception has been thrown by the target of an invocation.]
       System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
       System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +117
       System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247
       System.Activator.CreateInstance() +88
       Telerik.Sitefinity.Data.ManagerBase`1.GetManager(String providerName, String transactionName) +115
       Telerik.Sitefinity.Services.SystemManager.Initialize() +142
       Telerik.Sitefinity.Abstractions.Bootstrapper.RegisterRoutes(RouteCollection routes) +243
       Telerik.Sitefinity.Abstractions.Bootstrapper.Bootstrap() +338
       Telerik.Sitefinity.Web.SitefinityHttpModule.Init(HttpApplication context) +30
       System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +546
       System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
       System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
       System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375
    
    [HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
  2. Richard Baugh
    Richard Baugh avatar
    201 posts
    Registered:
    22 Aug 2012
    18 Apr 2011
    Link to this post
    I was getting this also. Go to the folder where the Sitefinity project manager is installed. Then copy all of the files that are in the _EmptyProject folder, except the "SitefinityWebApp.csproj" and "web.config", and paste them into your site and overwrite the files in your site. Once this was done, I was able to get the site to run. You may also want to re-build your site if you have any custom work in the site.

    Hopefully you already have a backup of your files if you need to revert back. I had a hard time upgrading one of my sites. I had reverted back to the beginning a couple of times. Hopefully this will help you get past it.
  3. Adam
    Adam avatar
    17 posts
    Registered:
    26 Feb 2009
    19 Apr 2011
    Link to this post
    Thanks for the tip, but unfortunately it didn't fix it. I still have the same error trying to access my site or even the Sitefinity admin console.
  4. Adam
    Adam avatar
    17 posts
    Registered:
    26 Feb 2009
    19 Apr 2011
    Link to this post
    Actually I mis-spoke, now there is still an error, but it is a different one:

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

    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.IO.FileLoadException: Could not load file or assembly 'Telerik.Sitefinity, Version=4.0.1210.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    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.

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'Telerik.Sitefinity, Version=4.0.1210.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' could not be loaded.

    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
    Running under executable  c:\windows\system32\inetsrv\w3wp.exe
    --- A detailed error log follows. 
    
    === Pre-bind state information ===
    LOG: User = PUBLIC\SRVC-MSDFORG
    LOG: DisplayName = Telerik.Sitefinity, Version=4.0.1210.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
     (Fully-specified)
    LOG: Appbase = file:///D:/msdf-sitefinity-dev/
    LOG: Initial PrivatePath = D:\msdf-sitefinity-dev\bin
    Calling assembly : HotNews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: D:\msdf-sitefinity-dev\web.config
    LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
    LOG: Post-policy reference: Telerik.Sitefinity, Version=4.0.1210.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/94e49acb/528216de/Telerik.Sitefinity.DLL.
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/94e49acb/528216de/Telerik.Sitefinity/Telerik.Sitefinity.DLL.
    LOG: Attempting download of new URL file:///D:/msdf-sitefinity-dev/bin/Telerik.Sitefinity.DLL.
    WRN: Comparing the assembly name resulted in the mismatch: Minor Version
    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
    

    Stack Trace:

    [FileLoadException: Could not load file or assembly 'Telerik.Sitefinity, Version=4.0.1210.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
       System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) +0
       System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +146
       System.Web.UI.Util.GetTypeFromAssemblies(IEnumerable assemblies, String typeName, Boolean ignoreCase) +184
       System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +600
       Telerik.Sitefinity.Utilities.TypeConverters.TypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +462
       Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityPageResolver.BuildControls(PageData pageData, List`1 controlConatiners, CursorCollection placeHolders) +864
       Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityPageResolver.RenderPage(StringBuilder output, PageData pageData, RequestContext context, String virtualPath) +350
       Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityPageResolver.Open(PathDefinition definition, String virtualPath) +254
       Telerik.Sitefinity.Abstractions.VirtualPath.VirtualPathManager.OpenFile(String virtualPath) +231
       System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) +256
       System.Web.UI.TemplateParser.Parse() +11172618
       System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() +135
       System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) +189
       System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() +265
       System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +46
       System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +580
       System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +619
       System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +203
       System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) +189
       System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +56
       Telerik.Sitefinity.Web.PageRouteHandler.GetHttpHandler(RequestContext requestContext) +844
       System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +11340424
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +266
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
  5. Brandon
    Brandon avatar
    50 posts
    Registered:
    30 Jul 2009
    19 Apr 2011
    Link to this post
    if you encounter this you'll need to rebuild any custom dll's with the newest build of the sitefinity dll's.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Apr 2011
    Link to this post
    Hi Adam,

    The error indicates mismatch of the assembly references. Please make sure that your project has correct references to the new dlls. If you have custom class libraries, please add the proper references.

    All the best,
    Ivan Dimitrov
    the Telerik team

  7. Pavel
    Pavel avatar
    14 posts
    Registered:
    25 Sep 2007
    19 Apr 2011
    Link to this post
    I kept getting the error even after updating the references. Apparently, in addition to updating references there are new DLLs to be copied over to the upgraded sites' BIN folder (I copied from _EmptyProject/bin):

    - Newtonsoft.Json.dll
    - Facebook.dll
  8. Brandon
    Brandon avatar
    50 posts
    Registered:
    30 Jul 2009
    19 Apr 2011
    Link to this post
    yes we did something similar pavel...we had to rebuild with the new reference dlls and then add our custom dll widget. then have to copy all the dlls from the emptyproject folder and then rebuild the sitefinity webapp main site for it to work again.
  9. mattc
    mattc avatar
    105 posts
    Registered:
    11 Aug 2007
    21 Apr 2011
    Link to this post
    I'm still getting the first error, looks like an ORM problem?

    I've copied over the new files and rebuilt the module and ORM data layer projects in the solution as well. This is a bit of a nightmare.

    I couldn't find a new version of the OpenAccess.SDK.dll

    I'm wondering if this comes with the stand alone install of ORM? Can't remember, maybe I need to upgrade the ORM tools to 2011 Q1?

    Matt
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    22 Apr 2011
    Link to this post
    Hello mattc,

    Please make sure that you made these OA changes to your custom modules.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

  11. HRC
    HRC avatar
    44 posts
    Registered:
    16 Mar 2009
    22 Apr 2011
    Link to this post
    I was getting this error on a brand new site.  The solution was to copy all the DLLs from the bin folder under: C:\Program Files (x86)\Telerik\Sitefinity 4.1\_EmptyProject\bin to my bin folder.

    There's this behaviour that I'm seeing once you load up the project in VS 2010 and recompile, it actually NUKES dlls that are necessary to run the project! 

    The DLLs that kept getting deleted were:

    - Facebook.dll
    - Newtonsoft.json.dll

    I put them back, added the whole bin folder to source control, so at least when I compile the files won't be deleted.

    See?

    ==========================================================================================

    ------ Rebuild All started: Project: SitefinityWebApp, Configuration: Debug Any CPU ------

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3607,9): warning MSB3061: Unable to delete file "C:\Projects\WebSite\bin\Facebook.dll". Access to the path 'C:\Projects\WebSite\bin\Facebook.dll' is denied.

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3607,9): warning MSB3061: Unable to delete file "C:\Projects\WebSite\bin\Newtonsoft.Json.dll". Access to the path 'C:\Projects\WebSite\bin\Newtonsoft.Json.dll' is denied.

    SitefinityWebApp -> C:\Projects\WebSite\bin\SitefinityWebApp.dll

    ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

  12. Richard Baugh
    Richard Baugh avatar
    201 posts
    Registered:
    22 Aug 2012
    22 Apr 2011
    Link to this post
    The deletion of dlls is a bug in VS. It has been reported to Microsoft, but to this day the bug remains. It normally doesn't do it all of the time, but it is a pain.
  13. HRC
    HRC avatar
    44 posts
    Registered:
    16 Mar 2009
    22 Apr 2011
    Link to this post
    Really?  I'm running VS 2010 Ultimate... 10.0.40219.1 SP1 Rel

    Never heard of this behaviour before where VS will arbitrarily decide to blow away DLLs in your bin.  Not saying it isn't possible, just saying I've never heard of it.

    Chris.
  14. Richard Baugh
    Richard Baugh avatar
    201 posts
    Registered:
    22 Aug 2012
    22 Apr 2011
    Link to this post
    Yes, it is VS. I have seen it do this on different versions of VS. At first I thought it was when I ran a "Build" but later found out that this was occurring when I did the "Rebuild" command also.

    I was wondering about this for some time. When I was watching a webinar with Lino Tadros at Falafel, he ran into the same issue. He had mentioned that the ticket had been created for this bug. This is where I got the info from. I tried to do a quick search on Google, but didn't find anything. 
14 posts, 0 answered