Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
IndexOutOfRangeException when having more the one floating window #291
the exception happens with the following scenario:
Here are links to the problem in the code:
during the dispose process, the code iterates over its collection and invoking the Close method, which in the described scenario invokes the following code :
the problem causes the collection to be changed within the Close method twice, while the i (index) still holding first value. which will causes IndexOutOfRangeException to be thrown.
suggested solution (only for DockPaneCollection, it supposed to be the same solution for FloatWindowCollection):
the internal Items collection, should be copied to an independent collection, which will iterate over the Items collection, those allowing the internal collection to be changed. at the end process just release the independent collection references to the DockPane items.
Had the same problem. It resides in DockPaneCollection.cs. I fixed it changing the Dispose method. Closing seems to remove sometimes more than one item from the collection. Hope this helps.