Skip to content
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

4.x: Fix InvalidOp when enumerating the SystemClockChanged hashset #880

Merged
merged 2 commits into from
Apr 8, 2019

Conversation

akarnokd
Copy link
Collaborator

@akarnokd akarnokd commented Apr 8, 2019

When the clock change is notified, any modification to the SystemClockChanged hashset from the callbacks results in an InvalidOperationException. The fix is to create a copy of the hashset contents and enumerate that.

Resolves #879

@clairernovotny
Copy link
Member

Is there any tests we can add to verify this behavior?

@akarnokd
Copy link
Collaborator Author

akarnokd commented Apr 8, 2019

Looks complicated to do it: get in a scheduler that unregisters itself upon a time change signal and also trigger a time change event. Maybe if we expose the relevant private fields or methods (such as OnSystemClockChanged()).

@clairernovotny
Copy link
Member

We can make things internal if needed, then I think the InternalsVisibleTo should let the tests call it. Another approach could be a new internal-only method that sets the values as desired just for testing?

@clairernovotny clairernovotny merged commit 962a3f7 into dotnet:rel/v4.1 Apr 8, 2019
@akarnokd akarnokd deleted the SystemClockChangeCrashFix branch April 8, 2019 16:39
liorm added a commit to Xperitos/Xperitos.Common that referenced this pull request Sep 10, 2019
It happens all the time when debugging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants