dotnet/winforms

Don't force creation of `Handle` in `OnHandleCreated`

Open

#2,235 建立於 2019年10月29日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)C# (922 fork)batch import
:beetle: bughelp wantedwaiting-on-team

倉庫指標

Star
 (4,100 star)
PR 合併指標
 (平均合併 14天 22小時) (30 天內合併 56 個 PR)

描述

See https://github.com/dotnet/winforms/pull/2141

The base class Control.OnHandleCreated checks for IsHandleCreated and does nothing if the handle isn't created.

In other sub-classes, we do not check if (IsHandleCreated) before accessing this.Handle which forces creation. This leads to strange recursive behaviour as OnHandleCreated is called again.

My opinion is that we should fix this oversight in base classes to ensure that they don't create the Handle in OnHandleCreated if a Handle doesn't exist

貢獻者指南