WI01110087 - Error creating window handle. - #40
Conversation
|
|
||
| // Handle should be created, before calling the BeginInvoke. | ||
| if (InvokeRequired && IsHandleCreated) | ||
| if (IsHandleCreated && InvokeRequired) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
| "version": "10.0.103", | ||
| "allowPrerelease": true, | ||
| "rollForward": "latestFeature", | ||
| "rollForward": "latestPatch", |
There was a problem hiding this comment.
"latestFeature" will make the build failure, please check the failed result of master build, and the discussion in the teams channel
WI01110087 - Error creating window handle.
Reference:
dotnet#14823
dotnet#14826