dotnet/winforms

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

开放

#2,235 创建于 2019年10月29日

 (3 条评论) (0 个反应) (0 位负责人)C# (922 个派生)batch import
:beetle: bughelp wantedwaiting-on-team

仓库指标

星标
 (4,100 个星标)
PR 合并指标
 (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

贡献者指南