Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Error deploying 3rd party controls - Unable to load one or more of the requested types

$
0
0
Hello,

I'm having a hard time integrating a series of 3rd. party .NET usercontrols into a Composite C1 (3.2 patch 1) web site.

Following advise in https://compositec1.codeplex.com/discussions/501218 I deployed my dlls into the site's bin folder but that somehow broke the site. I get the following error:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
This is raised on the layout of a master page in the following line:
<div class="ctbox"><rendering:Placeholder ID="contentLeftColumn" Title="Content Left Column" Default="true" runat="server" /></div>
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
   CompositeC1Contrib.Web.UI.F.Markup.<.cctor>b__0(Assembly a) +30
   System.Linq.<SelectManyIterator>d__14`2.MoveNext() +238
   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +177
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +327
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
   CompositeC1Contrib.Web.UI.F.Markup..cctor() +315

[TypeInitializationException: The type initializer for 'CompositeC1Contrib.Web.UI.F.Markup' threw an exception.]
   CompositeC1Contrib.Web.UI.F.Markup..ctor() +0
   CompositeC1Contrib.Web.UI.Rendering.Placeholder..ctor() +5
   ASP.app_data_pagetemplates_homelanding_master.__BuildControlcontentLeftColumn() in c:\site\App_Data\PageTemplates\HomeLanding.master:96
   ASP.app_data_pagetemplates_homelanding_master.__BuildControlcContent(Control __ctrl) in c:\site\App_Data\PageTemplates\HomeLanding.master:93
   System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12
   System.Web.UI.MasterPage.InstantiateInContentPlaceHolder(Control contentPlaceHolder, ITemplate template) +87
   ASP.app_data_pagetemplates_base_master.__BuildControlphContent() in c:\site\App_Data\PageTemplates\Base.master:99
   ASP.app_data_pagetemplates_base_master.__BuildControlTree(app_data_pagetemplates_base_master __ctrl) in c:\site\App_Data\PageTemplates\Base.master:1
   ASP.app_data_pagetemplates_base_master.FrameworkInitialize() in c:\site\App_Data\PageTemplates\Base.master.cs:912308
   System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
   System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +9037810
   System.Web.UI.MasterPage.get_Master() +42
   System.Web.UI.MasterPage.ApplyMasterRecursive(MasterPage master, IList appliedMasterFilePaths) +18
   System.Web.UI.Page.ApplyMasterPage() +9082889
   System.Web.UI.Page.PerformPreInit() +45
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +328
So, it seems that deploying my dlls into the bin breaks the site. One important thing though is that these usercontrols make use of EntLib 5 dlls for logging, exception handling, validating, etc.

I realized the built-in installation of Composite comes with some of these Dlls too but in version 3:
  • Microsoft.Practices.EnterpriseLibrary.Common.dll
  • Microsoft.Practices.EnterpriseLibrary.Logging.dll
  • Microsoft.Practices.EnterpriseLibrary.Validation.dll
I thought the version mismatch could be the problem so I tried to set an assembly binding on web.config with no luck. My last attempt is putting all the 3rd. paty dlls on /bin except for the 3 of the EntLib 3 that comes with the original installation (I left all the original dlls on /bin), then I created a new folder /bin/new and put the 3 version 5 dlls in there. Finally I set up the following on web.config:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Common" publicKeyToken="31bf3856ad364e35" />
      <codeBase version="5.0.414.0" href="bin\new\Microsoft.Practices.EnterpriseLibrary.Common.dll" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Logging" publicKeyToken="31bf3856ad364e35" />
      <codeBase version="5.0.414.0" href="bin\new\Microsoft.Practices.EnterpriseLibrary.Logging.dll" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Validation" publicKeyToken="31bf3856ad364e35" />
      <codeBase version="5.0.414.0" href="bin\new\Microsoft.Practices.EnterpriseLibrary.Validation.dll" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>
Doing this I don't get the typical assembly binding error but the one I described above. Perhaps the binding is working but some internal reflection is failing?

Replacing the original dlls with EntLib 5 version is not an option since existing code is expecting version 3. Keeping version 3 dlls is not an option since 3rd. party dlls expect version 5. A regular assemblyBinding (directing code using version 3 to use version 5) is not possible since EntLib 5 dlls have different public key token.

The only thing I'm sure is that the new dlls are braking the site (if I remove the dlls the site comes back online).

From this scenario I can extract two questions:
  • How should I do what I'm doing? What would be the correct approach when deploying 3rd. party dlls that also use EntLib assemblies? I'm sure I'm not the first person trying to do this.
  • Is there any way I can troubleshoot this? Is there any log that could provide better information on what's going on?
Thanks, any help would be much appreciated.

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>