Applying a site template causes PnP export template to crash
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Applying a site template changes the CanvasPosition's SectionIndex from an int to a float value (e.g. 1 becomes 1.0). The JSON deserializer throws an error because of this. The format change can be seen when inspecting the CanvasContent1 property of a SharePoint page before and after applying a site template.
Changing the SectionIndex definition to be a float or double seems to be the easy solution here?
PnP.Framework 1.9.0 was used, using this line:
context.Web.GetProvisioningTemplate(templateInfo);
Line that throws error:
https://github.com/pnp/pnpcore/blob/dev/src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/CanvasControl.cs#L331
CanvasPosition definition:
https://github.com/pnp/pnpcore/blob/999ab6da6da004b7f51965915837c0f6df4a81e7/src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/CanvasPosition.cs#L21

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/CanvasControl.cs around line 331 and compare it with the CanvasPosition definition in src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/CanvasPosition.cs. Reproduce the failure through context.Web.GetProvisioningTemplate(templateInfo) using a page whose CanvasContent1 contains a decimal SectionIndex. Done means the template export succeeds for both integer and decimal SectionIndex values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100