Closed jkoritzinsky closed 8 years ago
Which Dictionary is the one failing? The one in CoreMethods is an easy fix. The one in NetworkTable would be harder.
Its not actually the SubTableListener that's erroring. It stores those as the value. The key is returned when the listener is added in ntcore, which ntcore starts at 0 and increments for every listener. When ntcore is shutdown, it destroys all listeners and starts counting at 0 again.
I think I found the root of the issue. When disconnecting, NetworkTables.Native.CoreMethods.s_entryCallbacks
is not cleared. However, because of the disconnect -> connect process, ntcore resets the callback count (which it uses to generate the uid that is causing the exception). I'm going to try having it clear on shutdown and see if that fixes it.
With the fix, after shutdown as long as you create a new NetworkTable object using GetTable, it should pass. However any old NetworkTable objects would still fail.
The one in CoreMethods
. I'll test it out once AppVeyor finishes building it.
That fixed it. I'll close the issue.
I found an issue while working on a possible RobotDotNet Dashboard (replacement/complement of SmartDashboard). The following steps result in an
InvalidOperationException
from adding two elements with the same key to an internal dictionary:InvalidOperationException
from adding two elements with the same key to aDictionary
.