Not sure I picked the correct category, but my error suggest that it is web assembly.
I have a working api, tested with swagger. When I try to add the razor page, it seems to not to be able to access the controller to fetch the data.
Trying to see why I am getting errors pulling back data to my razor page.
I created a simple swagger to pull back /api/Dates. Works as expected.
This error is hard to see where it is coming from. I can see that it doesn’t even reach the controller.
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
System.Text.Json.JsonException: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
---> System.Text.Json.JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.Serialization.JsonConverter
1[[CaisClientServerApp.Shared.Dates[], CaisClientServerApp.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter1[[CaisClientServerApp.Shared.Dates[], CaisClientServerApp.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadCore[Dates[]](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadCore[Dates[]](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan
1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
at System.Text.Json.JsonSerializer.d__201[[CaisClientServerApp.Shared.Dates[], CaisClientServerApp.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at System.Net.Http.Json.HttpContentJsonExtensions.<ReadFromJsonAsyncCore>d__3
1[[CaisClientServerApp.Shared.Dates[], CaisClientServerApp.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at System.Net.Http.Json.HttpClientJsonExtensions.d__9`1[[CaisClientServerApp.Shared.Dates[], CaisClientServerApp.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at CaisClientServerApp.Client.Pages.FetchDates.OnInitializedAsync() in C:\codebase\CaisClientServerApp\Client\Pages\FetchDates.razor:line 42
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)