Closed hkillp closed 2 years ago
@hkillp would you mind adding a comment explaining what the cause of the problem was?
I am having the same problem, everything works perfectly until switching to use .NET 6 (Not sure if it is the same issue as the original poster.
The problem I am encountering is the store initializer does not seem to appropriately parse the javascript response in StoreInitializer.cs when calling:
protected override async Task OnAfterRenderAsync(bool firstRender)
try
{
**if (!await this.JSRuntime.InvokeAsync<bool>("tryInitializeFluxor"))**
throw new StoreInitializationException("Failed to initialize store");
await this.Store.InitializeAsync();
}
catch (JSException ex)
{
throw new StoreInitializationException("JavaScript error", (Exception) ex);
}
it appears to be returning a null and fails to determine that the initialize method succeeded, even though if I execute tryInitializeFluxor() or put a breakpoint in the javascript it should be returning true.
Error trace from Rider:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: JavaScript error Fluxor.Exceptions.StoreInitializationException: JavaScript error ---> Microsoft.JSInterop.JSException: An exception occurred executing JS interop: The JSON value could not be converted to System.Boolean. Path: $ | LineNumber: 0 | BytePositionInLine: 4.. See InnerException for more details. ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Boolean. Path: $ | LineNumber: 0 | BytePositionInLine: 4. ---> System.InvalidOperationException: Cannot get the value of a token type 'Null' as a boolean. at System.Text.Json.Utf8JsonReader.GetBoolean() at System.Text.Json.Serialization.Converters.BooleanConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at System.Text.Json.Serialization.JsonConverter1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, Boolean& value) at System.Text.Json.Serialization.JsonConverter
1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex) at System.Text.Json.Serialization.JsonConverter1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.Serialization.JsonConverter
1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ReadCoreAsObject(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadCore[Object](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.Read[Object](Utf8JsonReader& reader, JsonTypeInfo jsonTypeInfo) at System.Text.Json.JsonSerializer.Deserialize(Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options) at Microsoft.JSInterop.JSRuntime.EndInvokeJS(Int64 taskId, Boolean succeeded, Utf8JsonReader& jsonReader) --- End of inner exception stack trace --- at Microsoft.JSInterop.JSRuntime.
@hkillp @sinnerbenkei I just tried a basic counter app from scratch and it worked. Could either of you provide me with a repro?
@hkillp @sinnerbenkei I just tried a basic counter app from scratch and it worked. Could either of you provide me with a repro?
I can confirm as well that my app is currently running on dotnet 6 with Fluxor without any issues.
Sorry for late reply. My app is working well in .Net 6.
Vào 0:13, Th 2, 15 thg 11, 2021 robertmrobo @.***> đã viết:
@hkillp https://github.com/hkillp @sinnerbenkei https://github.com/sinnerbenkei I just tried a basic counter app from scratch and it worked. Could either of you provide me with a repro?
I can confirm that my app is currently running on dotnet 6 with Fluxor without any issues.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mrpmorris/Fluxor/issues/224#issuecomment-968330099, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG6OJN36U55TTOX7VSLVDMDUL7U4LANCNFSM5HDM2QAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
just wanted to drop back in and say after making some modifications to my project with varying results, eventually I tried upgrading to the 4.2.2 Alpha preview build, and I haven't had any issues since.
I have a Blazor web assembly project target .NET 5, this project implemented Fluxor. When I upgraded this project to .NET 6, it does not work anymore.
How to reproduce the issue?
So are there any workarounds to make it work or do we have to wait for other Fluxor versions to support .NET 6?