Hybridzz Hybridzz - 1 year ago 96
C# Question

Application not ending properly and running in the background

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)

foreach (Window w in App.Current.Windows)
if (w.DataContext != this)

Answer Source

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

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


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).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download