-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArgumentException when adding large number of subscriptions #17
Comments
I'm getting the same exception with much lower number of subscriptions: ~20 |
Hey, thanks for the PR, wondering why this was a Dictionary right now. Pre-Hashset-time? How could you verify that this sorts you out? I wanted to push a new version with netstandard as target, but I need to migrate the project.json stuff I have also. |
I've added a unit test that @sidhoda suggested. |
Sorry that your PR is sitting there, but I tried to upgrade to the new csproj stuff from .NET Core and looks like I failed, so I am doing another version with the project.json stuff and then hopefully I have the stuff up and running again. |
This has been fixed with commit e28770a. |
The following code will more often than not result in an ArgumentException being raised with the message "An item with the same key has already been added.":
Relevant part of the exception stack trace is
My guess is that two DisposableSubscription instances have the same hashcode, resulting in a collision when attempting to add it the subscription storage:
MemBus/MemBus/CompositeSubscription.cs
Line 99 in 8613a7e
Changing the subscriptions storage to HashSet would be a possible fix as the default IEqualityComparer will check for equality (in this case reference equality) when getting multiple elements with the same hash code.
The text was updated successfully, but these errors were encountered: