From 200d2ddfd55b62642e4eac4ea7b5f5d1c2ddbabf Mon Sep 17 00:00:00 2001 From: Hugh Bellamy Date: Mon, 13 Jan 2020 09:01:53 +0000 Subject: [PATCH] Fix BindingContext.SyncRoot --- .../src/System/Windows/Forms/BindingContext.cs | 2 +- .../tests/UnitTests/System/Windows/Forms/BindingContextTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/BindingContext.cs b/src/System.Windows.Forms/src/System/Windows/Forms/BindingContext.cs index cad0a5ae941..d489f7ccc44 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/BindingContext.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/BindingContext.cs @@ -70,7 +70,7 @@ IEnumerator IEnumerable.GetEnumerator() /// /// Gets an object to use for synchronization (thread safety). /// - object ICollection.SyncRoot => null; + object ICollection.SyncRoot => this; /// /// Gets the System.Windows.Forms.BindingManagerBase associated with the specified diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BindingContextTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BindingContextTests.cs index bebdda99ee2..defecb598d2 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BindingContextTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/BindingContextTests.cs @@ -26,7 +26,7 @@ public void BindingContext_ICollection_GetProperties_ReturnsExpected() { ICollection context = new BindingContext(); Assert.False(context.IsSynchronized); - Assert.Null(context.SyncRoot); + Assert.Same(context, context.SyncRoot); Assert.Empty(context); }