You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UpdateValueAndRemoveDeletedReferenceProperties throws InvalidOperationException: Collection was modified on every removal, so the deletion path of Assembler.Synchronize is dead — any Synchronize whose DTOs drop an element from an enumerable
reference property aborts mid-assembly.
Source: SysML2.NET.CodeGenerator/Templates/Uml/core-dal-poco-uml-extensions.hbs:78-90, replicated
into 231 call sites across 167 files under SysML2.NET.Dal/Core/AutoGenPocoExtension/. Affects OwnedRelationship, OwnedRelatedElement, and Dependency.Client / Supplier.
The emitted shape, e.g. SysML2.NET.Dal/Core/AutoGenPocoExtension/ForkNodeExtensions.cs:105-112:
Throws.Except is deferred over the live ContainerList; the loop body removes from the
collection it is streaming, invalidating the enumerator on the first removal.
Silently loses the deletions. Line 90 re-runs the deferred query after the removals, so identifiersOfObjectsToDelete returns empty and the removed POCOs leak in the cache. Fixing only
the throw leaves this in place.
What type of issue is this?
Description
UpdateValueAndRemoveDeletedReferencePropertiesthrowsInvalidOperationException: Collection was modifiedon every removal, so the deletion path ofAssembler.Synchronizeis dead — anySynchronizewhose DTOs drop an element from an enumerablereference property aborts mid-assembly.
Source:
SysML2.NET.CodeGenerator/Templates/Uml/core-dal-poco-uml-extensions.hbs:78-90, replicatedinto 231 call sites across 167 files under
SysML2.NET.Dal/Core/AutoGenPocoExtension/. AffectsOwnedRelationship,OwnedRelatedElement, andDependency.Client/Supplier.The emitted shape, e.g.
SysML2.NET.Dal/Core/AutoGenPocoExtension/ForkNodeExtensions.cs:105-112:Exceptis deferred over the liveContainerList; the loop body removes from thecollection it is streaming, invalidating the enumerator on the first removal.
identifiersOfObjectsToDeletereturns empty and the removed POCOs leak in the cache. Fixing onlythe throw leaves this in place.
Single(x => x.Id == identifier)is the scan-per-element [Tech Debt]: Assembler.Synchronize is O(n²) — 89 s to assemble a 50 000-element model #347 removed fromAssembler.Synchronize.Steps to Reproduce
Expected:
membershipand its ownedpackageare removed from the cache.Proposed fix
In the template — do not hand-edit generated files:
Tasks
SysML2.NET.Dal/Core/AutoGenPocoExtension/.AssemblerTestFixture— none exists today, which is why this was missed.identifiersOfObjectsToDeleteis populated for the firsttime; the
Assemblerdeletion loop has never executed.System Configuration