1

I have a simple wpf application. But it is using CefSharp to open some links in chrome based browser. I found that once the main window of the application is closed, It is closed from the UI but it still runs in the background.

I tried adding additional code to force close it. but no hope. I think some components of cefsharp is not ending correctly. but not exactly sure on what is going wrong.

Used the below code and some other snippets too

protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);


            foreach (Window w in App.Current.Windows)
            {
                if (w.DataContext != this)
                    w.Close();
            }
            Application.Current.Shutdown();
        }
Sin
  • 1,836
  • 2
  • 17
  • 24

1 Answers1

1

As I said in my comment, try: Environment.Exit(0);

If that doesn't work, start with Cef.Shutdown();

https://stackoverflow.com/a/9050477/1274820

If you REALLY need it to close out you can also use Environment.Exit() but it is not graceful at all (more like ending the process).

Community
  • 1
  • 1
user1274820
  • 7,786
  • 3
  • 37
  • 74