I have an app that contains objects like so
I am utilizing the HTML5 Drag and Drop API to allow the user to drag groups and interfaces to/from other groups.
In order to move, I add the Payload (dragged object) to the new object then remove it from it’s Parent’s Item List.
I have discovered that the Payload.Parent.Items.Remove() call causes the object to be disposed. If I comment it out, the drag functionality works fine except it doesn’t remove the object from its original location. If I add an Interface element to several Groups, then delete that Interface, all references are removed as well as the original object is deleted.
I have even implemented IDisposable in the Item base class with a simple Console.WriteLine so I can see the objects being disposed. I would expect, since they were added to another List, that they would NOT be disposed. Why would they, if they are required by another object?
Is this expected behavior? Am I missing something here?
Nevermind, I figured it out.
https://github.com/dotnet/aspnetcore/issues/15846
Gotta use @key in the Components so they’re tied to the object.
C# devs
null reference exceptions