pnp / pnpframework

PnP Framework is a .NET library targeting Microsoft 365 containing the PnP Provisioning engine and a ton of other useful extensions
https://pnp.github.io/pnpframework/
MIT License
212 stars 145 forks source link

Save ProvisioningHierarchy in 1.5 creates some times wrong Xml-Element Order #372

Open czullu opened 3 years ago

czullu commented 3 years ago

the strange issue is, that saving the ProvisioningHierarchy with XMLOpenXMLTemplateProvider to a pnp-file creates sometimes the XML-Elements in wrong order which make the Template fail when load again in XmlPnPSchemaBaseSerializer.GetValidationResults

What did happen multiple time is that pnp:Templates is first followed by pnp:Preferences, pnp:Localization and the pnp:Teams

@PaoloPia i went back to commit e40396c4b3ef86d974ed39f0fd6426599a652cda - before schema changes. With that Version i can not reproduce the issue.

jansenbe commented 3 years ago

@czullu : I've seen that before and so far, we've not been able to reproduce. Our testing a while ago indicated that it only failed in .NET Core...are you using that?

czullu commented 3 years ago

Yes, It happens in .net core 3.1 for me and I was also not really able to track it down as it seems like 1 out of 10 having this issue. I fixed it on my side by reorder the elements on import. Let me provide this and you can decide if that's good enough for now.

Holen Sie sich Outlook für Androidhttps://aka.ms/AAb9ysg


From: Bert Jansen @.> Sent: Friday, July 2, 2021 6:44:28 PM To: pnp/pnpframework @.> Cc: Christian Zuellig @.>; Mention @.> Subject: Re: [pnp/pnpframework] Save ProvisioningHierarchy in 1.5 creates some times wrong Xml-Element Order (#372)

@czulluhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fczullu&data=04%7C01%7C%7C96b31961344b447d559c08d93d78a8e7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637608410697979247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=jbkf2fY3zlfebb1WbjP4qP%2FJnYLpmhQlvgWBV3drGAg%3D&reserved=0 : I've seen that before and so far, we've not been able to reproduce. Our testing a while ago indicated that it only failed in .NET Core...are you using that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpnp%2Fpnpframework%2Fissues%2F372%23issuecomment-873127236&data=04%7C01%7C%7C96b31961344b447d559c08d93d78a8e7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637608410697979247%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=rw20tjraXjNH4M6lngOhH407hOb33vk2p%2FQnUQ5J8M4%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAHPCQUK7XNZBNU7ZZFUXPNTTVXUGZANCNFSM46M7P7MQ&data=04%7C01%7C%7C96b31961344b447d559c08d93d78a8e7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637608410697989249%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2%2Fq0%2BQLAHwVDVw1L5CldbpjAZNZ92VOjxrGLw%2BFlxSY%3D&reserved=0.

andikrueger commented 3 years ago

I'm facing this issue too. I see XML files with wrong sequences too>

  </pnp:Templates>
  <pnp:Preferences Generator="PnP.Framework, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null" />
</pnp:Provisioning>

The xml above was created in a PowerShell 7.1 session using PnP.PowerShell to export a list as a template. The xml file is generated wrong in all my test runs.

Adding addtional data to the templates fails during schema validation with the following error:

Add-PnPDataRowsToSiteTemplate: 
Line |
  36 |      Add-PnPDataRowsToSiteTemplate -Path $tempFile -List 'PnPTestList' …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The element 'Provisioning' in namespace 'http://schemas.dev.office.com/PnP/2021/03/ProvisioningSchema'
     | has invalid child element 'Preferences' in namespace
     | 'http://schemas.dev.office.com/PnP/2021/03/ProvisioningSchema'. List of possible elements expected:
     | 'Templates, Sequence, Teams, AzureActiveDirectory, Drive, ProvisioningWebhooks' in namespace
     | 'http://schemas.dev.office.com/PnP/2021/03/ProvisioningSchema'.

Add-PnPDataRowsToSiteTemplate:
Line |
  36 |      Add-PnPDataRowsToSiteTemplate -Path $tempFile -List 'PnPTestList' …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Invalid template file!

Write-Error: PnP.PowerShell.Commands.Model.PnPException
andikrueger commented 3 years ago

450 is caused by this issue.