Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<WtgPackageVersionPrefix>0.1.0</WtgPackageVersionPrefix>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(WtgPackageVersionPrefix)-dev</PackageVersion>
<PackageDescription>WiseTech Global forked version of System.Windows.Forms that includes controls that were deprecated in .NET Core 3.1 and .NET 5, like DataGrid, Menu, ToolBar and StatusBar.</PackageDescription>
<PackageReleaseNotes>Fix the accessibility access on DataGrid components, PR link: https://github.com/WiseTechGlobal/winforms/pull/41</PackageReleaseNotes>
<PackageReleaseNotes>Handle disposed AsyncWaitHandle during BeginInvoke completion, version 0.2.17, PR link: https://github.com/WiseTechGlobal/winforms/pull/42</PackageReleaseNotes>
<Authors>WiseTech Global</Authors>
<Copyright>© WiseTech Global Limited. All rights reserved.</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ internal void Complete()
lock (_invokeSyncObject)
{
IsCompleted = true;
_resetEvent?.Set();
try
{
_resetEvent?.Set();
}
catch (ObjectDisposedException)
{
// AsyncWaitHandle exposes the event and allows callers to dispose it before completion.
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3850,6 +3850,21 @@ await Task.Run(() =>
Assert.Equal(0, createdCallCount);
}

[WinFormsFact]
public void Control_BeginInvoke_DisposedAsyncWaitHandle_CompletesCallback()
{
using Control control = new();
Assert.NotEqual(IntPtr.Zero, control.Handle);
bool callbackInvoked = false;
IAsyncResult asyncResult = control.BeginInvoke(() => callbackInvoked = true);
asyncResult.AsyncWaitHandle.Dispose();

Application.DoEvents();

Assert.True(callbackInvoked);
Assert.True(asyncResult.IsCompleted);
}

[WinFormsFact]
public void Control_Invoke_Action_calls_correct_method()
{
Expand Down
Loading