question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure Functions: [A]PnPManifest cannot be cast to [B]PnPManifest

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:27 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
jansenbecommented, May 26, 2021

@YannickRe : been way too busy…so did not have time for this. Feel free to keep bumping it

1reaction
czullucommented, Mar 2, 2021

Hi, you might try to change your csproj of the Azure Function and add this Line “<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>”

in here like this:

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
  </PropertyGroup>

This usually helps to resolve conflicts with classes which the Azure Function Framework uses as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding the Azure Active Directory app manifest
The application manifest contains a definition of all the attributes of an application object in the Microsoft identity platform.
Read more >
Not able to access the manifest - Microsoft Q&A
So, I go to the configuration page and then to the Manage option under Microsoft App Id, further selecting the Manifest option from...
Read more >
Troubleshoot error: Azure Functions Runtime is unreachable
This issue occurs when the Functions runtime can't start. The most common reason for this is that the function app has lost access...
Read more >
Cannot update KeyCredential 'Value' in Azure application ...
It will let me upload a manifest with the Value set, but then it wipes it out and resets it back to null....
Read more >
Spring Cloud Function 2.0 and Azure Functions
I'm having issues resolving the Main Class in my Azure Function: Failed to discover main class. An attempt was made to discover main...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found