Search code examples
ormsitecoreglass-mapper

MissingMethodException: Method not found: 'System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)'


I am getting missing method exception in Sitecore while using Glass mapper. This is working in Sitecore 7 project but when I tried to use same in Sitecore 6.6 project it fails. I am not getting that how to find what is the problem in underlying method invocation going on.

I guess this may be due to .net framework version difference in Sitecore 6.6 and Sitecore 7.0

I am using Glass.Mapper.Sc.CastleWindsor nuget package version 3.0.3.7

[MissingMethodException: Method not found: 'System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)'.]
Glass.Mapper.Utilities.CreateConstructorDelegates(Type type) +0
Glass.Mapper.Pipelines.ConfigurationResolver.Tasks.OnDemandResolver.OnDemandLoader`1.Load() +102
System.Linq.WhereSelectArrayIterator`2.MoveNext() +110
System.Linq.Enumerable.Aggregate(IEnumerable`1 source, Func`3 func) +123
Glass.Mapper.Context.Load(IConfigurationLoader[] loaders) +284
Glass.Mapper.Pipelines.ConfigurationResolver.Tasks.OnDemandResolver.ConfigurationOnDemandResolverTask`1.Execute(ConfigurationResolverArgs args) +155
Glass.Mapper.Pipelines.AbstractPipelineRunner`2.Run(T args) +210
Glass.Mapper.AbstractService.InstantiateObject(AbstractTypeCreationContext abstractTypeCreationContext) +77
Glass.Mapper.Sc.SitecoreService.CreateType(Type type, Item item, Boolean isLazy, Boolean inferType, Object[] constructorParameters) +297
Glass.Mapper.Sc.SitecoreService.CreateType(Item item, Boolean isLazy, Boolean inferType) +109
Glass.Mapper.Sc.Web.Ui.GlassUserControl`1.GetModel() +147
Glass.Mapper.Sc.Web.Ui.GlassUserControl`1.OnLoad(EventArgs e) +28
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048

Also I am not able to find complete source anywhere for Glass mapper.


Solution

  • It's your .NET framework version. Am guessing your Sitecore 7 runs as .NET 4.5 and your 6.6 solution on something lower.

    Recent builds of 6.6 (as of atleast 130404) support .NET Framework Version 4.5

    System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)

    http://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%206/ReleaseNotes/ChangeLog/Release%20History%20SC66.aspx#660update6