When i need to exit a WPF Application i usually use Application.Current.Shutdown() but sometimes the  Application.Currentis NULL,I also tried Environment.Exit(0) but it doesn't work correctly.
Is there any other way to exit a WPF Applicationspecialy when Application.Current is NULL?
this is my code:
 public partial class App : Application
 {
    protected override void OnStartup(StartupEventArgs e)
    {
      if (something)
        {
          continue....
        }
      else
        {
        Application.Current.Shutdown()
        }
  }
 
     
    