powershell: [BUG] VSCode Move-PnPFile : Method not found: 'Int32 System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8(System.ReadOnlySpan1)'.
- Are you using
Invoke-PnPSiteTemplateorGet-PnPSiteTemplate? No
Reporting an Issue or Missing Feature
When trying to execute the command
Move-PnPFile -SourceUrl "/sites/Leadership-365/Shared Documents/Regional Managers" -TargetUrl "/sites/operations.leaders/Shared Documents" -AllowSchemaMismatch
I get the following error:
Move-PnPFile : Method not found: 'Int32 System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8(System.ReadOnlySpan1)'.
What is this error about?
Expected behavior
Run the cmdlet
Actual behavior
Error: Method not Found
Steps to reproduce behavior
When trying to execute the command
Move-PnPFile -SourceUrl "/sites/Leadership-365/Shared Documents/Regional Managers" -TargetUrl "/sites/operations.leaders/Shared Documents" -AllowSchemaMismatch
I get the following error:
Move-PnPFile : Method not found: 'Int32 System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8(System.ReadOnlySpan1)'.
What is the version of the Cmdlet module you are running?
(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable)
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.5.38 PnP.PowerShell {Add-PnPAlert, Add-PnPApp, Add-PnPApplicationCustomizer, Add-PnPAzureADGroupMember...}
Which operating system/environment are you running PnP PowerShell on?
- Windows
- Linux
- MacOS
- Azure Cloud Shell
- Azure Functions
- Other : please specify
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 28 (4 by maintainers)
Closing this issue now. Since v2.1.1 , PnP PowerShell is fully on .NET 6, so we have dropped support for PS5.1 or ISE. If the issue still exists, please feel free to reopen it.
Try running it in regular VS Code terminal, not in the PowerShell Integrated Console. I had a similar issue with Add-PnPApp and it works on the regular terminal. If you check the versions of the 2 consoles running Get-Host | Select-Object Version, regular console is 5.1.18362.1801, whereas the PowerShell Integrated Console is 2021.9.0.
I can also confirm that downgrading to 1.5.0 resolves the issue in VSCode (mine was with the Add-PnPGroupMember cmdlet).
@ingepepe - I don’t think VSCode is not an issue as I’ve been able to successfully run your code. I’m still not able to reproduce unfortunately and it’s working fine for me.
Let’s see if @gautamdsheth / @erwinvanhunen have any ideas / insights.