SaaS CMS has officially launched! Learn more now.

Unable to load one or more of the requested types.

Vote:
 

Hi,

I have an initialization module which defines an always apply filter for PageData and MediaData.

When I run the site I am getting the exception :

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

The loader exception contains :

{"Could not load type 'Castle.Proxies.SearchRegisterPageProxy' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.":"Castle.Proxies.SearchRegisterPageProxy"}

Two others are running the exact same code and do not experience this problem. Any ideas what could cause this or how I might go about diagnosing the problem?

Thanks,

Aaron

#119444
Mar 27, 2015 17:50
Vote:
 

I have the same error, and it's intermittent. Sometimes the website works, but for most part it doesn't. The support is not able to reproduce the error in their environment with my code either.

You can try to delete all temprorary ASP.NET files, recycle the app pool, clean solution and then re-build. That worked for my colleague.

#119451
Mar 27, 2015 21:11
Vote:
 

Did you solve this Aaron? Or do you still have the same error, I'm still struggling with it.

#119625
Mar 31, 2015 19:01
Vote:
 

Just ran into the same problem when updating the references. Anyone have a solution for this?

#119740
Apr 02, 2015 11:34
Vote:
 

Does your "SearchRegisterPage" have any dependencies that are injected in the constructor? If the implementations of those dependencies are set up in init modules then you need to ensure that your custom module has a dependency on the module that sets up those dependencies.

If the above is true then the desired initialisation order is:

  • EPiServer Core initialisation
  • RegisterCustomImplementationsForSearch
  • YourCustomInitModule

However unless you explicitly set init module dependencies then EPiServer can execute them in any order so you may end up executing 1. 3. 2. rather than 1. 2. 3. which may explain the intermittent error.

Let me know if any of this doesn't make sense or needs more explanation!

#119749
Apr 02, 2015 12:27
Vote:
 

In case the wording above isn't clear this is what I meant in code:

[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class RegisterCustomImplementationsForSearch : IInitializableModule
{
    public void Initialize(InitializationEngine context)
    {
        //Your work here
    }

    public void Preload(string[] parameters) { }

    public void Uninitialize(InitializationEngine context) { }
}

Then:

[InitializableModule]
[ModuleDependency(typeof(RegisterCustomImplementationsForSearch))]
public class YourCustomInitModule : IInitializableModule
{
    public void Initialize(InitializationEngine context)
    {
        //Your work here
    }

    public void Preload(string[] parameters) { }

    public void Uninitialize(InitializationEngine context) { }
}
#119786
Apr 02, 2015 13:17
Vote:
 

The problem appears to have been introduced in Find 9.1. Downgrading to Find 9.0 resolves the issue.

#119793
Edited, Apr 02, 2015 14:47
Vote:
 
<p></p> <p>In my case the error is not just on one content type, it changes for every reload of the website. If I enable log4net logging, the website works(!?). So it's kinda hard to debug...</p> <p>Have no constructors or dependencies that needs to be resolved.</p> <p>When I remove ModuleDependency completely, but keeping InitilizableModule, the website works. So it seems to be related to how things are executed. My module used to have a dependency to IndexingModule.</p> <p></p>
#119797
Apr 02, 2015 16:11
Vote:
 

Just a quick update here... I got a pre-release package from EPiServer where this bug is fixed. So there will hopefully be a fix out soon.

#120373
Apr 15, 2015 22:30
Vote:
 

Hi! Any news on this? I seem to have the same problem. It was intermittent until yesterday when I updated to the latest EPi + Find. Now I can't start the site at all.

I have tried to find some intialization order problem but I can't find it.

The exception is always thrown when I do UnifiedSearchRegistry.ForInstanceOf<>().UseHitType<>() in an initialization module setting up Find conventions.

#120910
Edited, Apr 28, 2015 7:14
Vote:
 
<p></p> <p>Did you try to remove the ModuleDependency&nbsp;attribute and just keep InitilizableModule? That worked for me.</p> <p></p>
#120912
Apr 28, 2015 7:46
Vote:
 

Hmm, actually I tried that after reading your post, but before I updated to the latest versions yesterday.

Now I removed it from my Find conventions initialization module again and it works! :) Thank you!

#120913
Apr 28, 2015 7:53
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.