4

While integrating castle windsor into sitecore 8.2 project with glass.mapper, we are getting below error when it was trying to map Internal Link field type. Is there any specific version of glass mapper that resolves this issue? relevant glass issue # 227 - https://github.com/mikeedwards83/Glass.Mapper/issues/227

Configuration: Sitecore showconfig initialize section

Exception:

Exception: Glass.Mapper.MapperException Message: Failed to map property WidgetTitle on UNWomen.SC.Common.Model.Communications.sitecore.templates.UN_Women.Communications.Items.Generic_Highlight Source: Glass.Mapper at Glass.Mapper.Configuration.AbstractTypeConfiguration.MapPropertiesToObject(Object obj, IAbstractService service, AbstractTypeCreationContext context) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper\Configuration\AbstractTypeConfiguration.cs:line 138

Nested Exception

Exception: Glass.Mapper.MapperException Message: Failed to map to property 'WidgetTitle' on type 'UNWomen.SC.Common.Model.Communications.sitecore.templates.UN_Women.Communications.Items.Generic_Highlight' Source: Glass.Mapper at Glass.Mapper.AbstractDataMapper.MapCmsToProperty(AbstractDataMappingContext mappingContext) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper\AbstractDataMapper.cs:line 68 at Glass.Mapper.Configuration.AbstractTypeConfiguration.MapPropertiesToObject(Object obj, IAbstractService service, AbstractTypeCreationContext context) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper\Configuration\AbstractTypeConfiguration.cs:line 121

Nested Exception

Exception: Glass.Mapper.MapperException Message: Failed to map to property 'WidgetTitle' on type 'UNWomen.SC.Common.Model.Communications.sitecore.templates.UN_Women.Communications.Items.Generic_Highlight' Source: Glass.Mapper at Glass.Mapper.AbstractDataMapper.MapCmsToProperty(AbstractDataMappingContext mappingContext) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper\AbstractDataMapper.cs:line 68 at Glass.Mapper.Configuration.AbstractTypeConfiguration.MapPropertiesToObject(Object obj, IAbstractService service, AbstractTypeCreationContext context) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper\Configuration\AbstractTypeConfiguration.cs:line 121

Nested Exception

Exception: Glass.Mapper.MapperException Message: Failed to map field {DD6452B1-3612-462B-92D3-534212C67172} with value /sitecore/content/Settings/Common Text/Communications/Widgets/Highlights Source: Glass.Mapper.Sc at Glass.Mapper.Sc.DataMappers.AbstractSitecoreFieldMapper.GetField(Field field, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper.Sc\DataMappers\AbstractSitecoreFieldMapper.cs:line 147 at Glass.Mapper.AbstractDataMapper.MapCmsToProperty(AbstractDataMappingContext mappingContext) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper\AbstractDataMapper.cs:line 60

Nested Exception

Exception: System.NullReferenceException Message: Configuration Resolver pipeline did not return a type. Has the type been loaded by Glass.Mapper. Type: System.Object Source: Glass.Mapper at Glass.Mapper.AbstractService.InstantiateObject(AbstractTypeCreationContext abstractTypeCreationContext) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper\AbstractService.cs:line 144 at Glass.Mapper.Sc.SitecoreService.CreateType(Type type, Item item, Boolean isLazy, Boolean inferType, Dictionary`2 parameters, Object[] constructorParameters) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper.Sc\SitecoreService.cs:line 506 at Glass.Mapper.Sc.DataMappers.SitecoreFieldTypeMapper.GetFieldValue(String fieldValue, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper.Sc\DataMappers\SitecoreFieldTypeMapper.cs:line 64 at Glass.Mapper.Sc.DataMappers.AbstractSitecoreFieldMapper.GetField(Field field, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper.Sc\DataMappers\AbstractSitecoreFieldMapper.cs:line 134

2

This issue has been mentioned here: http://www.glass.lu/Mapper/Sc/Documentation/CommonQuestionsAndProblems/SystemObjectError. When T4 templates are used to generate glass based models, it generated model properties of type "object" for every "internal link" field type. And glass.mapper.sc has stopped mapping properties of type 'object' as part of a fix for issue# 85 in glass mapper github repo.

So, one can start using Glass.Mapper.Sc.Fields.Link type to corresponding to sitecore fields of type "internal link". Then, Any version of glass.mapper would work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.