pnpframework: Azure Functions: [A]PnPManifest cannot be cast to [B]PnPManifest
I load my PnP Template from a .pnp file, and this works without a problem when executing locally. If I deploy my Azure Function, I get the following error:
[Error] Error Message: [A]PnP.Framework.Provisioning.Connectors.OpenXML.Model.PnPManifest cannot be cast to [B]PnP.Framework.Provisioning.Connectors.OpenXML.Model.PnPManifest. Type A originates from 'PnP.Framework, Version=0.1.109.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\home\site\wwwroot\bin\PnP.Framework.dll'. Type B originates from 'PnP.Framework, Version=0.1.109.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\home\site\wwwroot\bin\PnP.Framework.dll'.
[Error] Error while processing dossier: [A]PnP.Framework.Provisioning.Connectors.OpenXML.Model.PnPManifest cannot be cast to [B]PnP.Framework.Provisioning.Connectors.OpenXML.Model.PnPManifest. Type A originates from 'PnP.Framework, Version=0.1.109.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\home\site\wwwroot\bin\PnP.Framework.dll'. Type B originates from 'PnP.Framework, Version=0.1.109.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\home\site\wwwroot\bin\PnP.Framework.dll'.
at PnP.Framework.Provisioning.Connectors.OpenXML.PnPPackage.GetXamlSerializedPackagePartValue[T](PackagePart part)
at PnP.Framework.Provisioning.Connectors.OpenXML.PnPPackage.get_Manifest()
at PnP.Framework.Provisioning.Connectors.OpenXML.PnPPackageExtensions.LoadPnPPackage(PnPPackage package)
at PnP.Framework.Provisioning.Connectors.OpenXML.PnPPackageExtensions.UnpackTemplate(MemoryStream stream)
at PnP.Framework.Provisioning.Connectors.OpenXMLConnector..ctor(String packageFileName, FileConnectorBase persistenceConnector, String author, X509Certificate2 signingCertificate, String templateFileName)
at ...
If I switch my code to run from .xml, it works in Azure Functions. Problem seems to happen in this method, but I don’t see why. There are two casts happening… https://github.com/pnp/pnpframework/blob/6b7b45166cf4fd17412fe3dff9ef14a6a1def35d/src/lib/PnP.Framework/Provisioning/Connectors/OpenXML/PnPPackage.cs#L315-L350
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 27 (23 by maintainers)
@YannickRe : been way too busy…so did not have time for this. Feel free to keep bumping it
Hi, you might try to change your csproj of the Azure Function and add this Line “<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>”
in here like this:
This usually helps to resolve conflicts with classes which the Azure Function Framework uses as well.
Don’t feel like we should let this close automatically… 🙂
@jansenbe I have a repro on https://github.com/YannickRe/PnPFrameworkIssue91
siteUrl
,userName
andpassword
It might require multiple executions in a short timespan to get to the error message. As you can see in the screenshot my first execution worked but the second failed.
No rush…
I’ll try and get a repro Azure Function v3 over the weekend! Biggest issue is that this only occurs in Azure, not when running the function locally. Otherwise I’d be able to easier debug.