Skip to content

Cannot add standard to existing method #243

@christoph-maurer

Description

@christoph-maurer
mutation {
  updateMethod(
    input: {
      methodId: "554e8ea0-afa7-4c24-885c-92e31e471976"
      categories: [CALCULATION]
      description: "Calculate integral values according to EN410:2011 based on spectral data."
      name: "EN 410 integral"
      sources: []
      parameters: []
      reference: { standard: { numeration: { mainNumber: "410" }, standardizers: DIN } }
    }
  ) {
    method {
      name
    }
    errors {
      code
      message
      path
    }
  }
}

fails with "message": "Unexpected Execution Error". The logs state

attributes.error.Exception: "System.InvalidOperationException: The instance of entity type 'Method.Reference#Reference.Standard#Standard.Numeration#Numeration' cannot be tracked because another instance with the same key value for {'StandardReferenceMethodId'} is already being tracked. When replacing owned entities, modify the properties without changing the instance or detach the previous owned entity entry first. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values.\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.ThrowIdentityConflict(InternalEntityEntry entry)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.Add(TKey key, InternalEntityEntry entry, Boolean updateDuplicate)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.Add(TKey key, InternalEntityEntry entry)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.Add(InternalEntityEntry entry)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking(InternalEntityEntry entry)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.OnStateChanging(EntityState newState)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntryBase.SetEntityState(EntityState oldState, EntityState newState, Boolean acceptChanges, Boolean modifyProperties)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState entityState, Boolean acceptChanges, Boolean modifyProperties, Nullable`1 forceStateWhenUnknownKey, Nullable`1 fallbackState)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction(EntityEntryGraphNode`1 node)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode`1 node, Func`2 handleNode)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode`1 node, Func`2 handleNode)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode`1 node, Func`2 handleNode)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph(InternalEntityEntry rootEntry, EntityState targetState, EntityState storeGeneratedWithKeySetTargetState, Boolean forceStateWhenUnknownKey)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.NavigationFixer.NavigationReferenceChanged(InternalEntityEntry entry, INavigationBase navigationBase, Object oldValue, Object newValue)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectNavigationChange(InternalEntityEntry entry, INavigationBase navigationBase)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.LocalDetectChanges(InternalEntityEntry entry)\n   at Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.DetectChanges()\n   at Microsoft.EntityFrameworkCore.DbContext.TryDetectChanges()\n   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)\n   at Metabase.GraphQl.Methods.MethodMutations.UpdateMethodAsync(UpdateMethodInput input, ClaimsPrincipal claimsPrincipal, MethodAuthorization authorization, ApplicationDbContext context, CancellationToken cancellationToken) in /app/src/GraphQl/Methods/MethodMutations.cs:line 218\n   at HotChocolate.Resolvers.Expressions.ExpressionHelper.AwaitTaskHelper[T](Task`1 task)\n   at HotChocolate.Types.Helpers.FieldMiddlewareCompiler.<>c__DisplayClass9_0.<<CreateResolverMiddleware>b__0>d.MoveNext()\n--- End of stack trace from previous location ---\n   at Metabase.GraphQl.Users.UserObjectFieldDescriptorExtensions.<>c__DisplayClass1_1.<<UseUserManager>b__1>d.MoveNext() in /app/src/GraphQl/Users/UserObjectFieldDescriptorExtensions.cs:line 51\n--- End of stack trace from previous location ---\n   at HotChocolate.Authorization.AuthorizeMiddleware.InvokeAsync(IMiddlewareContext context)\n   at HotChocolate.Authorization.AuthorizeDirectiveType.<>c__DisplayClass3_0.<<CreateMiddleware>b__1>d.MoveNext()\n--- End of stack trace from previous location ---\n   at HotChocolate.Execution.Processing.Tasks.ResolverTask.ExecuteResolverPipelineAsync(CancellationToken cancellationToken)\n   at HotChocolate.Execution.Processing.Tasks.ResolverTask.TryExecuteAsync(CancellationToken cancellationToken)"

What can we do?

Metadata

Metadata

Assignees

Labels

2601Issues for the end of project EQWIN-PISEFraunhofer Institute for Solar Energy Systems ISE

Type

No type
No fields configured for issues without a type.

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions