When selecting the browser component for WPF or WinForms applications, DotNetBrowser and CefSharp are among the obvious choices.

In this article, we explain the difference between DotNetBrowser and CefSharp and how to choose between them.

In a nutshell

Choose open-source CefSharp when:

  • You have to use free software.

Choose commercial DotNetBrowser when:

  • You need a custom feature.
  • You want to get assistance with product use.
  • You want to report issues confidentially and have them fixed.
  • You need to run on Linux and macOS.
  • You need to embed a browser into Office applications.
  • You have requirements for software security.
Spinner

Sending…

Sorry, the sending was interrupted

Please try again. If the issue persists, contact us at info@teamdev.com.

Read and agree to the terms to continue.

Your personal DotNetBrowser trial key and quick start guide will arrive in your Email Inbox in a few minutes.

Support and updates

CefSharp is an open-source project. If you see a bug or need a feature, you can file a report or contribute. In 2022, the project had 33 major and minor releases.

DotNetBrowser is a commercial product designed and created for commercial companies.

We have a private helpdesk system where reports from clients remain confidential. The guaranteed first response time, or SLA, is one business day.

The technical support includes:

  • Help with product use.
  • Timely bug fixes.
  • Assistance with troubleshooting.
  • Considering feature requests.

All your support requests will be processed by DotNetBrowser software engineers.

A new version of DotNetBrowser is released almost every month. We upgrade Chromium to the latest stable version (with the latest security patches and fixed vulnerabilities) within 3–4 weeks after its official release.

Linux and macOS

DotNetBrowser runs natively on Linux and macOS, both on x86-64 and ARM platforms.

At this moment, you can use DotNetBrowser in a headless application, but DotNetBrowser will also support Avalonia UI very soon.

Let us know if you want to try DotNetBrowser with Avalonia UI now.

Architecture

CefSharp is a .NET wrapper around the Chromium Embedded Framework or CEF. The wrapping is done via C++/CLI.

DotNetBrowser doesn’t use CEF or C++/CLI under the hood. Instead, it brings its own approach to integrating with Chromium directly.

In-process vs. out-of-process

CefSharp starts the Chromium engine inside the .NET process. The library requires the engine to be started and shutdown in the main application thread and only once in the process lifetime.

DotNetBrowser starts the Chromium engine as a separate process. There is no requirement to do this on the main UI thread—even the worker thread will do. You can start and shutdown Chromium anytime. You can use several Chromium engines simultaneously.

DotNetBrowser architecture

DotNetBrowser architecture

CefSharp architecture

CefSharp architecture

Stability and security

The CefSharp model allows you to start the application faster, but it has major drawbacks:

  • CefSharp doesn’t support the built-in Chromium sandbox.
  • CefSharp consumes the memory and CPU of the .NET process.
  • If CefSharp crashes, the whole application crashes too.
  • The .NET process becomes susceptible to security vulnerabilities in Chromium, as they use the same address space.

In DotNetBrowser, an error inside Chromium doesn’t lead to a crash in your .NET application. Instead, you can detect and handle the crash appropriately:

engine.Disposed += (s, e) => 
{
    long exitCode = e.ExitCode;
    // If the exit code is non-zere, the engine crashed.
});

Distribution and deployment

CefSharp requires the Microsoft Visual C++ Runtime to be installed in the environment.

DotNetBrowser comes with all required Chromium binaries and DLLs already packaged. You don’t need to pre-install Microsoft Visual C++ Runtime to work with DotNetBrowser.

Embedding into Office

DotNetBrowser works in non-default AppDomains and thus can be embedded into Office applications using VSTO add-ins or Excel-DNA.

CefSharp works only in the default AppDomain.

H.264, AAC

Proprietary codes work in DotNetBrowser out of the box. They’re disabled by default, but you can enable them in the code:

IEngine engine = EngineFactory.Create(new EngineOptions.Builder
{
    ProprietaryFeatures = ProprietaryFeatures.H264 | ProprietaryFeatures.Aac
}.Build());

CefSharp is distributed without proprietary codec supports.

High DPI

In CefSharp, the default DPI awareness for the browser subprocess is Per-Monitor. This requires the whole application to be DPI aware, which may be an issue for older software.

DotNetBrowser automatically detects DPI awareness of the .NET process and complies with it.

DOM access

In CefSharp, the only way to access DOM is to use JavaScript. DotNetBrowser provides API for manipulating DOM directly your code:

IDocument document = browser.MainFrame.Document;
document.GetElementById("button").Click();

PointInspection inspection = browser.MainFrame.Inspect(new Point(100, 150));
INode nodeAtPoint = inspection.Node;

Chrome extensions

Support for Chrome extensions is a popular request among DotNetBrowser and CefSharp users.

In DotNetBrowser, extension support is in active development. We’re almost there: we polish the C++ part and design the .NET part.

Let us know if you want to try Chrome extensions in DotNetBrowser.

Try for free

Get your free license and choose one of our getting started guides. It takes 5 minutes to start using DotNetBrowser: