Skip to content

"Error creating window handle." From PictureBox.OnFrameChanged #14823

Closed

Description

@jaywang-cn

.NET version

.net10

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

not tested.

Issue description

Hi I'm facing the the issue with following message:

ExceptionType: System.ComponentModel.Win32Exception
Message: Error creating window handle.
Stacktrace:

  at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) 
   at System.Windows.Forms.Control.CreateHandle() 
   at System.Windows.Forms.Control.get_Handle() 
   at System.Windows.Forms.Control.IHandle<Windows.Win32.Foundation.HWND>.get_Handle() 
   at System.Windows.Forms.Control.get_InvokeRequired() 
   at System.Windows.Forms.PictureBox.OnFrameChanged(Object o, EventArgs e) 
   at System.Drawing.ImageAnimator.ImageInfo.AdvanceAnimationBy(Int64 milliseconds) 
   at System.Drawing.ImageAnimator.AnimateImages() 
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 

I've checked the code and the code in the PictureBox has InvokeRequired && IsHandleCreated

Image

While in other controls e.g. Label, ButtonBase, the code is IsHandleCreated && InvokeRequired

Image Image

Do you think if the property check order is the root cause of the issue?

Steps to reproduce

Cannot reproduce it.

Activity

  1. added
    untriagedThe team needs to look at this issue in the next triage
    on Jul 29, 2026
  2. self-assigned this
    on Jul 30, 2026
  3. removed
    untriagedThe team needs to look at this issue in the next triage
    on Aug 5, 2026
  4. added this to the 11.0-rc1 milestone on Aug 20, 2026
  5. Zheng-Li01 commented on Aug 20, 2026

    @Zheng-Li01
    Member

    No steps to verify, just checked the code have been changed in main branch of dotnet/winforms repro as below screenshot.

    Image
  6. Zheng-Li01 commented on Aug 27, 2026

    @Zheng-Li01
    Member

    Checked the code have been changed in release/11.00rc1 branch of dotnet/winforms repro, it has the same validation result as above.

  7. locked and limited conversation to collaborators on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions