dotnet/winforms

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

Open

#2.235 geöffnet am 29. Okt. 2019

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (922 Forks)batch import
:beetle: bughelp wantedwaiting-on-team

Repository-Metriken

Stars
 (4.100 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 14T 22h) (56 gemergte PRs in 30 T)

Beschreibung

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

Contributor Guide