title: WPF mutex for single app instance not working
body: <p>I'm trying to use the mutex method for only allowing one instance of my app to run. That is - I only want a max of one instance for all users on a machine. I've read through the various other threads on this issue and the solution seems straightforward enough but in testing I can't get my second instance to not run. Here is my code...</p>
  
  <pre><code>public partial class App : Application
  {
      protected override void OnStartup(StartupEventArgs e)
      {
          // check that there is only one instance of the control panel running...
          bool createdNew = true;
          using (Mutex instanceMutex = new Mutex(true, @"Global\ControlPanel", out createdNew))
          {
              if (!createdNew)
              {
                  Application.Current.Shutdown();
                  return;
              }
          }
  
          base.OnStartup(e);
      }
  }
  </code></pre>