Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbandonedMutexException on UpdateManager.RestartApp using GitHubUpdate manager #1837

Open
johnbridgwater opened this issue Nov 19, 2022 · 0 comments

Comments

@johnbridgwater
Copy link

johnbridgwater commented Nov 19, 2022

Squirrel version(s)
2.0.1

Description
RestartApp causing AbandonedMutexException

Steps to recreate

  1. Start up application that is using GitHubUpdateManager
  2. Leave the application running for 5 minutes (to ensure app has finished update process)
  3. Select manual user action that calls to UpdateManager.RestartApp();

Expected behavior
The application should restart without causing an exception

Actual behavior
The application does restart but an exception is logged in event log:
"Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Threading.AbandonedMutexException
at Squirrel.SingleGlobalInstance.Finalize()"

This occurs as old version is shutting down.

Additional information
I have a c# winform application with the following code in program.cs:
` static async Task Main()
//static void Main()
{
AppLogging.WriteLog("Checking for updates...");

        using (var mgr = UpdateManager.GitHubUpdateManager(Properties.Settings.Default.GitHubPath))
          // "https://github.com/grips-tiresoft/webprintingapp"
        {
            try
            {
                await  mgr.Result.UpdateApp();
                mgr.Result.CreateRunAtWindowsStartupRegistry();
            }
            catch (Exception e)
            {
                AppLogging.WriteLog(string.Format("Exception: {0} occurred, message: {1}", e.InnerException.GetType().ToString(), e.InnerException.Message));
            }
        }

        AppLogging.WriteLog("Update Check completed");

There is action that user can invoke:

private void Restart_Click(object sender, EventArgs e) { UpdateManager.RestartApp(); }

Additionally, no message was logged in catch statement above, so it is not occurring during the update phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant