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
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"sdk": {
"version": "10.0.103",
"allowPrerelease": true,
"rollForward": "latestFeature",
"rollForward": "latestPatch",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that need to change?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"latestFeature" will make the build failure, please check the failed result of master build, and the discussion in the teams channel

"paths": [
".dotnet",
"$host$"
Expand Down Expand Up @@ -30,4 +30,4 @@
"native-tools": {
"cmake": "latest"
}
}
}
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 ToolStrip issue, PR link: https://github.com/WiseTechGlobal/winforms/pull/39</PackageReleaseNotes>
<PackageReleaseNotes>Fix the PictureBox issue, PR link: https://github.com/WiseTechGlobal/winforms/pull/40</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 @@ -1050,7 +1050,7 @@ private void OnFrameChanged(object? o, EventArgs e)
}

// Handle should be created, before calling the BeginInvoke.
if (InvokeRequired && IsHandleCreated)
if (IsHandleCreated && InvokeRequired)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow in that thread Microsoft just fixed by changing the if condition and not re-evaluating that the property has side effects.

Might be worth for us to remember that InvokeRequired seems to have side effects

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily side-effects.

Problem here was, that we checked first if an Invoke was required. But: To call that method, the control must have created the respective handle for the native Window it needs already. Now - if we do not have a handle, then InvokeRequired fails. So, switching this is safe here, because && is a short-circuit AND expression: If InvokeRequired returns false, then IsHandleCreated will not at all be called - since the whole expression does not have a chance at this point to become true, anyway (so, what's the point in calling the second one, right? 😸)

And that was exactly, what has happened every now and then: No Handle --> InvokeRequired was called anyway, and of course failed. Now: No Handle, we test that...and if there is none, then we bail early and do not touch InvokeRequired.

Hope the helps to shed a bit of light on this fix!

Happy weekend!

Klaus

{
lock (_internalSyncObject)
{
Expand Down
Loading