Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Semantic domains results in several different errors #1090

Closed
myieye opened this issue Sep 27, 2024 · 0 comments · Fixed by #1098
Closed

Updating Semantic domains results in several different errors #1090

myieye opened this issue Sep 27, 2024 · 0 comments · Fixed by #1098
Labels
bug Something isn't working 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related

Comments

@myieye
Copy link
Contributor

myieye commented Sep 27, 2024

Describe the bug
Note these errors currently don't occur when changing the semantic domain of the first sense due to #1073.

If I try to update the semantic domain to 2 semantic domains (or just one, but I think it worked with one a few times, so I'm not sure), I get this stack trace:

[fw-lite:local-web-app] fail: Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher[8]
[fw-lite:local-web-app]       Failed to invoke hub method 'UpdateSense'.
[fw-lite:local-web-app]       System.InvalidCastException: Unable to cast object of type 'System.Text.Json.JsonElement' to type 'MiniLcm.Models.SemanticDomain'.
[fw-lite:local-web-app]          at LcmCrdt.Utils.JsonPatchRewriter.RewriteChanges[T,TProp](JsonPatchDocument`1 patchDocument, Expression`1 expr, Func`4 changeFactory)+MoveNext() in D:\code\languageforge-lexbox\backend\FwLite\LcmCrdt\Utils\JsonPatchRewriter.cs:line 59
[fw-lite:local-web-app]          at LcmCrdt.Objects.Sense.ChangesFromJsonPatch(Sense sense, JsonPatchDocument`1 patch)+MoveNext() in D:\code\languageforge-lexbox\backend\FwLite\LcmCrdt\Objects\Sense.cs:line 41
[fw-lite:local-web-app]          at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
[fw-lite:local-web-app]          at LcmCrdt.CrdtMiniLcmApi.UpdateSense(Guid entryId, Guid senseId, UpdateObjectInput`1 update) in D:\code\languageforge-lexbox\backend\FwLite\LcmCrdt\CrdtMiniLcmApi.cs:line 299
[fw-lite:local-web-app]          at LocalWebApp.Hubs.MiniLcmApiHubBase.UpdateSense(Guid entryId, Guid senseId, JsonPatchDocument`1 update) in D:\code\languageforge-lexbox\backend\FwLite\LocalWebApp\Hubs\MiniLcmApiHubBase.cs:line 83
[fw-lite:local-web-app]          at LocalWebApp.Hubs.CrdtMiniLcmApiHub.UpdateSense(Guid entryId, Guid senseId, JsonPatchDocument`1 update) in D:\code\languageforge-lexbox\backend\FwLite\LocalWebApp\Hubs\CrdtMiniLcmApiHub.cs:line 55
[fw-lite:local-web-app]          at lambda_method25(Closure, Object)
[fw-lite:local-web-app]          at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.ExecuteMethod(ObjectMethodExecutor methodExecutor, Hub hub, Object[] arguments)
[fw-lite:local-web-app]          at LocalWebApp.Hubs.LockedProjectFilter.InvokeMethodAsync(HubInvocationContext invocationContext, Func`2 next) in D:\code\languageforge-lexbox\backend\FwLite\LocalWebApp\Hubs\LockedProjectFilter.cs:line 12
[fw-lite:local-web-app]          at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.<Invoke>g__ExecuteInvocation|18_0(DefaultHubDispatcher`1 dispatcher, ObjectMethodExecutor methodExecutor, THub hub, Object[] arguments, AsyncServiceScope scope, IHubActivator`1 hubActivator, HubConnectionContext connection, HubMethodInvocationMessage hubMethodInvocationMessage, Boolean isStreamCall)

If I replace the only semantic domain on a sense with a different one, I get this stack trace:

Moved to #1099

If I remove all the semantic domains I get this stack trace:

[fw-lite:local-web-app]       Failed to invoke hub method 'UpdateSense'.
[fw-lite:local-web-app]       Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
[fw-lite:local-web-app]        ---> System.NotSupportedException: Runtime type 'LcmCrdt.Changes.RemoveSemanticDomainChange' is not supported by polymorphic type 'SIL.Harmony.Changes.IChange'. Path: $.
[fw-lite:local-web-app]        ---> System.NotSupportedException: Runtime type 'LcmCrdt.Changes.RemoveSemanticDomainChange' is not supported by polymorphic type 'SIL.Harmony.Changes.IChange'.       
[fw-lite:local-web-app]          at System.Text.Json.ThrowHelper.ThrowNotSupportedException_RuntimeTypeNotSupported(Type baseType, Type runtimeType)
[fw-lite:local-web-app]          at System.Text.Json.Serialization.Metadata.PolymorphicTypeResolver.TryGetDerivedJsonTypeInfo(Type runtimeType, JsonTypeInfo& jsonTypeInfo, Object& typeDiscriminator)
[fw-lite:local-web-app]          at System.Text.Json.Serialization.JsonConverter.ResolvePolymorphicConverter(Object value, JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options, WriteStack& state)
[fw-lite:local-web-app]          at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
[fw-lite:local-web-app]          at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
[fw-lite:local-web-app]          --- End of inner exception stack trace ---
[fw-lite:local-web-app]          at System.Text.Json.ThrowHelper.ThrowNotSupportedException(WriteStack& state, NotSupportedException ex)
[fw-lite:local-web-app]          at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
[fw-lite:local-web-app]          at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
[fw-lite:local-web-app]          at System.Text.Json.JsonSerializer.WriteString[TValue](TValue& value, JsonTypeInfo`1 jsonTypeInfo)
[fw-lite:local-web-app]          at lambda_method730(Closure, IChange)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter`2.<>c__DisplayClass6_0`2.<SanitizeConverter>b__1(Object v)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping.CreateParameter(DbCommand command, String name, Object value, Nullable`1 nullable, ParameterDirection direction)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) 
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
[fw-lite:local-web-app]          --- End of inner exception stack trace ---
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
[fw-lite:local-web-app]          at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
[fw-lite:local-web-app]          at SIL.Harmony.Db.CrdtRepository.AddCommit(Commit commit) in D:\code\languageforge-lexbox\backend\harmony\src\SIL.Harmony\Db\CrdtRepository.cs:line 269
[fw-lite:local-web-app]          at SIL.Harmony.DataModel.Add(Commit commit, Boolean deferSnapshotUpdates) in D:\code\languageforge-lexbox\backend\harmony\src\SIL.Harmony\DataModel.cs:line 88       
[fw-lite:local-web-app]          at SIL.Harmony.DataModel.Add(Commit commit, Boolean deferSnapshotUpdates) in D:\code\languageforge-lexbox\backend\harmony\src\SIL.Harmony\DataModel.cs:line 100      
[fw-lite:local-web-app]          at SIL.Harmony.DataModel.AddChanges(Guid clientId, IEnumerable`1 changes, Guid commitId, CommitMetadata commitMetadata, Boolean deferCommit) in D:\code\languageforge-lexbox\backend\harmony\src\SIL.Harmony\DataModel.cs:line 78
[fw-lite:local-web-app]          at LcmCrdt.CrdtMiniLcmApi.UpdateSense(Guid entryId, Guid senseId, UpdateObjectInput`1 update) in D:\code\languageforge-lexbox\backend\FwLite\LcmCrdt\CrdtMiniLcmApi.cs:line 299
[fw-lite:local-web-app]          at LocalWebApp.Hubs.MiniLcmApiHubBase.UpdateSense(Guid entryId, Guid senseId, JsonPatchDocument`1 update) in D:\code\languageforge-lexbox\backend\FwLite\LocalWebApp\Hubs\MiniLcmApiHubBase.cs:line 83
[fw-lite:local-web-app]          at LocalWebApp.Hubs.CrdtMiniLcmApiHub.UpdateSense(Guid entryId, Guid senseId, JsonPatchDocument`1 update) in D:\code\languageforge-lexbox\backend\FwLite\LocalWebApp\Hubs\CrdtMiniLcmApiHub.cs:line 55
[fw-lite:local-web-app]          at lambda_method25(Closure, Object)
[fw-lite:local-web-app]          at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.ExecuteMethod(ObjectMethodExecutor methodExecutor, Hub hub, Object[] arguments)
[fw-lite:local-web-app]          at LocalWebApp.Hubs.LockedProjectFilter.InvokeMethodAsync(HubInvocationContext invocationContext, Func`2 next) in D:\code\languageforge-lexbox\backend\FwLite\LocalWebApp\Hubs\LockedProjectFilter.cs:line 12
[fw-lite:local-web-app]          at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.<Invoke>g__ExecuteInvocation|18_0(DefaultHubDispatcher`1 dispatcher, ObjectMethodExecutor methodExecutor, THub hub, Object[] arguments, AsyncServiceScope scope, IHubActivator`1 hubActivator, HubConnectionContext connection, HubMethodInvocationMessage hubMethodInvocationMessage, Boolean isStreamCall)
@myieye myieye added bug Something isn't working 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant