Pnpframework: ConvertTo-PnPPage error The collection type 'System.Collections.Generic.Dictionary`2[System.UInt32,System.String]' is not supported

Created on 22 Jan 2021  路  12Comments  路  Source: pnp/pnpframework

Hi!

I'm trying to run the command 'ConvertTo-PnPPage' but this returns the error: 'ConvertTo-PnPPage : The collection type 'System.Collections.Generic.Dictionary`2[System.UInt32,System.String]' is not supported.'

This command works fine with the 'SharePointPnPPowerShellOnline' module.

There is no logfile created with the Set-PnpTraceLog and because of the error message I thought this was something with libraries being loaded incorrectly. Is this correct and therefore the right place to submit this error?

Full cmdlet:
ConvertTo-PnPPage -PublishingPage -Identity "<url>" -Overwrite -TargetWebUrl $targetUrl

page transformation 馃 bug

All 12 comments

Hi @leupenb,

I've just tried to convert a complex publishing page hosted in SPO to a modern page in SPO and that worked fine. Can you provide some more information about your "case":

  • Does the source page live in SPO or in on-premises?
  • Please provide the output of Get-PnPException immediately after the ConvertTo-PnPPage call failes

Hi @jansenbe

The (classic) source page lives in SPO and has a custom page layout. I have tried this with a OOTB page layout as well.
I have also tried this from a different tenant (but to the same source).

I get the following exception:
Message : The collection type 'System.Collections.Generic.Dictionary2[System.UInt32,System.String]' is not supported. Stacktrace : at System.Text.Json.JsonClassInfo.GetElementType(Type propertyType, Type parentType, MemberInfo memberInfo, JsonSerializerOptions options) at System.Text.Json.JsonClassInfo.CreateProperty(Type declaredPropertyType, Type runtimePropertyType, Type implementedPropertyType, PropertyInfo propertyInfo, Type parentClassType, JsonConverter converter, JsonSerializerOptions options) at System.Text.Json.JsonClassInfo.AddProperty(Type propertyType, PropertyInfo propertyInfo, Type classType, JsonSerializerOptions options) at System.Text.Json.JsonClassInfo.AddPolicyProperty(Type propertyType, JsonSerializerOptions options) at System.Text.Json.JsonClassInfo..ctor(Type type, JsonSerializerOptions options) at System.Text.Json.JsonSerializerOptions.GetOrAddClass(Type classType) at System.Text.Json.WriteStackFrame.Initialize(Type type, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.WriteCore(Utf8JsonWriter writer, Object value, Type type, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.WriteCore(PooledByteBufferWriter output, Object value, Type type, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.WriteCoreString(Object value, Type type, JsonSerializerOptions options) at PnP.Framework.Modernization.Cache.Extensions.ToByteArray(Object obj) at PnP.Framework.Modernization.Cache.Extensions.Set[T](IDistributedCache distributedCache, String key, T value, DistributedCacheEntryOptions options) at PnP.Framework.Modernization.Cache.CacheManager.GetPublishingPagesLibraryName(ClientContext context) at PnP.PowerShell.Commands.Pages.ConvertToClientSidePage.ExecuteCmdlet() at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() ScriptLineNumber : 1

Can you cross check which version you're using...add -verbose to the Connect-PnPOnline cmdlet to check the version

I can simulate the issue now, will work on a fix.

Great! Thanks!

Issue has been fixed. @leupenb : can you try with tomorrow's nightly build of PnP PowerShell (that will be version 1.2.2 or higher) and verify the problem is fixed for you?

@jansenbe absolutely, it will be monday morning and I will post te result here

@jansenbe I've done a reinstall of the module with 'Install-Module PnP.PowerShell -AllowPrerelease'.
After running ConvertTo-PnPPage I get the error message: 'Could not find file 'PnP.Framework.resources'
How can I fix this?

The version installed is: 1.2.4.0
Version of the framework is 1.1.4.0.

Full error message is:

Message : Could not find file 'PnP.Framework.resources'.
Stacktrace : at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark&
stackMark)
at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean
createIfNotExists, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at PnP.Framework.CoreResources.get_ClientContextExtensions_ExecuteQueryRetryException()
at Microsoft.SharePoint.Client.ClientContextExtensions.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent)
at PnP.PowerShell.Commands.Base.PipeBinds.ClassicPagePipeBind.GetPage(Web web, String listToLoad)
at PnP.PowerShell.Commands.Pages.ConvertToClientSidePage.ExecuteCmdlet()
at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord()
ScriptLineNumber : 1

Can you manually delete the module and install again to see if that helps? See C:\Users\\Documents\PowerShell\Modules for the location

I have removed the module from the C:\Program Files\WindowsPowerShell\Modules directory as it was installed there. In the C:\Users\Documents\PowerShell\Modules directory there is no PnP module installed.
After the removal I have run 'Install-Module PnP.PowerShell -AllowPrerelease'.

I still get the same error message, so I thought to install the 1.2.0.0 version first, as I don't get that specific message there, and update to 1.2.5. If I run 'Update-Module PnP.PowerShell -AllowPrerelease' I get the message:

_The version '1.2.5' of the module 'PnP.PowerShell' being installed is not catalog signed. Ensure that the version '1.2.5' of the module
'PnP.PowerShell' has the catalog file 'PnP.PowerShell.cat' and signed with the same publisher 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' as the
previously-installed module 'PnP.PowerShell' with version '1.2.0' under the directory 'C:\Program Files\WindowsPowerShell\Modules\PnP.PowerShell\1.2.0'. If you still want to install or
update, use -SkipPublisherCheck parameter._

Thanks for you help :)

Yeah, we're not signing our nightly releases, so you might not be able to upgrade from an official one into a nightly version. What seems to happen is that you get an error while loading the page before it's being send to the page transformation component. Can you run Get-PnPException after the error and see what that outputs. Also please share the cmdline you're using

Allright, I made a stupid mistake and connected to the wrong site, so the bug is actually fixed (no more error messages)!
Thanks for the bug fixing and sorry for the confusion :)

Was this page helpful?
0 / 5 - 0 ratings