diff --git a/WordsLive/Utils/WpfSingleInstance.cs b/WordsLive/Utils/WpfSingleInstance.cs index 2e5806c..2c66348 100644 --- a/WordsLive/Utils/WpfSingleInstance.cs +++ b/WordsLive/Utils/WpfSingleInstance.cs @@ -26,11 +26,7 @@ internal static void Make(string appName, bool uniquePerUser = true) bool isSecondaryInstance = true; EventWaitHandle eventWaitHandle = null; - try - { - eventWaitHandle = EventWaitHandle.OpenExisting(eventName); - } - catch + if (!EventWaitHandle.TryOpenExisting(eventName, out eventWaitHandle)) { // This code only runs on the first instance. isSecondaryInstance = false;