U4-4119 - PackagingService Export ContentType fails if doctype properties are in Generic Properties tab

Created by Kevin Jump 22 Jan 2014, 19:49:29 Updated by Shannon Deminick 19 Mar 2014, 03:43:02

When calling

public XElement Export(IContentType contentType, bool raiseEvents = true)

to export a DocumentType, the export will fail. with the error below if any of the DocumentType's properties are defined in the Generic properties section of the type.

System.NullReferenceException: Object reference not set to an instance of an object. at Umbraco.Core.Services.PackagingService.<>c__DisplayClass1e.b__1c(PropertyGroup x) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate) at Umbraco.Core.Services.PackagingService.Export(IContentType contentType, Boolean raiseEvents)

this is because the PropertyGroupId is not set so the call in the code below throws an exception

contentType.PropertyGroups.FirstOrDefault(x => x.Id == propertyType.PropertyGroupId.Value);

Comments

Shannon Deminick 13 Feb 2014, 04:10:12

PR here: https://github.com/umbraco/Umbraco-CMS/pull/287


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 6.1.6, 7.0.2

Due in version: 7.1.0, 6.2.0

Sprint:

Story Points:

Cycle: