pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

PnP.Framework 1.5.0 LoadClientSidePage() Exception

Open IvoryFeng opened this issue 3 years ago • 0 comments

Below is the code I am using in a .NET Core 3.1 console application.

var clientSidePage = clientContext.Web.LoadClientSidePage(mordernPageName);

For most of the pages, the above code works. For a few pages, it throws an exception. All pages work fine for end users in browsers.

Below is an example of the exception:

Message: '3' is invalid after a value. Expected either ',', '}', or ']'. LineNumber: 0 | BytePositionInLine: 2103.

at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker) at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.JsonDocument.Parse(ReadOnlySpan1 utf8JsonSpan, Utf8JsonReader reader, MetadataDb& database, StackRowStack& stack) at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedBytes) at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory1 json, JsonDocumentOptions options) at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options) at PnP.Core.Model.SharePoint.PageWebPart.FromHtml(IElement element) at PnP.Core.Model.SharePoint.Page.LoadFromHtml(String html, String pageHeaderHtml) at PnP.Core.Model.SharePoint.Page.LoadPageAsync(IList pagesLibrary, IListItem item) at PnP.Core.Model.SharePoint.Page.LoadPagesAsync(PnPContext context, String pageName) at PnP.Core.Model.SharePoint.Web.GetPagesAsync(String pageName) at PnP.Core.Model.SharePoint.Web.GetPages(String pageName) at Microsoft.SharePoint.Client.PageExtensions.LoadClientSidePage(Web web, String pageName)

IvoryFeng avatar Jul 26 '22 17:07 IvoryFeng