[NBug] Cannot access a disposed object.Object name: 'FormBrowse'.

Author: Oberon00Created Jun 20, 2023Updated Sep 20, 2026
Labelstype: bug :bug:status: workaround availablepotential-duplicate

Environment

  • Git Extensions 4.1.0.16698
  • Build 1fe52a137acef1fbd2b653dea263b44ad5844177
  • Git 2.41.0.windows.1
  • Microsoft Windows NT 10.0.22621.0
  • .NET 6.0.18
  • DPI 96dpi (no scaling)

Issue description

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'FormBrowse'.
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.Form.CreateHandle()
   at System.Windows.Forms.Control.get_Handle()
   at System.Windows.Forms.ContainerControl.FocusActiveControlInternal()
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(msoloop reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(msoloop reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at GitUI.GitUICommands.StartBrowseDialog(IWin32Window owner, BrowseArguments args) in C:\projects\gitextensions\GitUI\GitUICommands.cs:line 1163
   at GitUI.GitUICommands.RunBrowseCommand(IReadOnlyList`1 args) in C:\projects\gitextensions\GitUI\GitUICommands.cs:line 1606
   at GitUI.GitUICommands.RunCommandBasedOnArgument(IReadOnlyList`1 args, IReadOnlyDictionary`2 arguments) in C:\projects\gitextensions\GitUI\GitUICommands.cs:line 1460
   at GitUI.GitUICommands.RunCommand(IReadOnlyList`1 args) in C:\projects\gitextensions\GitUI\GitUICommands.cs:line 1433
   at GitExtensions.Program.RunApplication() in C:\projects\gitextensions\GitExtensions\Program.cs:line 204
   at GitExtensions.Program.Main() in C:\projects\gitextensions\GitExtensions\Program.cs:line 105

Closed window right after starting.

Steps to reproduce

Start gitextensions inside a folder with a git repository. Close it right away, while the UI still seems to be loading by middle clicking (press mouse wheel) on the window preview from the Windows taskbar. Seems to be 100% reliably reproducible for me that way.

Note that this does not seem to work by clicking the X button, as there is seems to block that until the UI is fully loaded.

Did this work in previous version of GitExtensions?

I never observed this with earlier versions, but I might also not have run into the case.

Diagnostics

No response

Source: gitextensions/gitextensions