desktop: Application hangs when trying to discard changes

Describe the bug

When trying to discard changes, the application becomes unresponsive.

Version & OS

2.9.7 (x64) Windows 10 21H2 (19044.1526)

Steps to reproduce the behavior

  1. Change a file in any repository
  2. Open the Changes tab
  3. Right click on the applicable file
  4. Click Discard changes in the context menu
  5. Click Discard changes in the confirmation dialog

Expected behavior

  • The changes are discarded

Actual behavior

  • A spinner icon appears in the dialog title bar
  • The whole application becomes unresponsive
  • Nothing happens when clicking Discard changes or Cancel
  • The changes are not discarded

Screenshots

github-discard

Logs

Not much relevant content in the logs. This is the only line written:

2022-02-15T11:32:53.506Z - info: [ui] No submodules found. Skipping "git submodule status"

Additional context

  • I have waited about 10 minutes for the operation to finish
  • The only solution is to terminate the application from Task Manager
  • I have checked that there are no other processes using the file
  • I have tried to discard multiple file types (.js, .html, .json)
  • I have tried multiple repositories. All repositories are non-GitHub.
  • I have tried deleting %AppData%\GitHub Desktop to start “fresh”
  • Downgrading to 2.9.6 fixes the problem
  • Not directly related, but the application seems slower to start in 2.9.7

I was unsure whether I should open a new issue or comment on #13433 or #13661, but those appear closed by #13436.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 15 (6 by maintainers)

Most upvoted comments

My Recycle bin is also set to not set delete items immediately. Plus as I mentioned, my local repo is on a network NAS share in which deletes don’t normally go into the recycle bin. And yes, this was all working before upgrade.

An option to disable discarding changes to recycle bin all together would be stellar

@t3knoid Likely it is a similar issue in that the electron.trashItem() fails since it cannot access it (before this upgrade it would have silently failed to do so)

My current work folder is located in a mounted NAS share. It wouldn’t be part of recycle bin. Is this a similar use case as the one described in #13899?

Here’s the specific error I’m seeing in the console:

index.tsx:131 Uncaught exception {name: 'Error', message: "Error invoking remote method 'move-to-trash': Error: Failed to perform delete operation", stack: "Error: Error invoking remote method 'move-to-trash…iscard-changes\\discard-changes-dialog.tsx:153:42)"}
rM @ index.tsx:131
(anonymous) @ index.tsx:204
emit @ node:events:394
Kp @ non-fatal-exception.ts:44
(anonymous) @ index.tsx:222
node:electron/js2c/renderer_init:61 Uncaught (in promise) Error: Error invoking remote method 'move-to-trash': Error: Failed to perform delete operation
    at EventEmitter.i.invoke (node:electron/js2c/renderer_init:61)
    at async git-store.ts:1462
    at async queue-work.ts:39
    at async ks.discardChanges (git-store.ts:1457)
    at async Object._discardChanges (app-store.ts:4357)
    at async Object.AS.discard [as onSubmit] (discard-changes-dialog.tsx:153)

Thanks @palhal, I was able to reproduce this issue as well on my Windows machine with those options configured.