Skip to content

AbandonedMutexException on UpdateManager.RestartApp using GitHubUpdate manager #1837

@johnbridgwater

Description

@johnbridgwater

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions