Skip to content

Latest commit

 

History

History

Gapotchenko.FX.Diagnostics.WebBrowser

Gapotchenko.FX.Diagnostics.WebBrowser

License NuGet

It turns out that launching a web browser is a black voodoo art that should be grasped on every particular version of an operating system.

.NET developers used to do this trick back in the day:

using System.Diagnostics;

Process.Start("https://example.com/");

Looks easy enough? It is, but there is a catch (or lots of them):

  • Sometimes web browser is started while the Process.Start(…) method throws an exception on some machines
  • Sometimes it starts not the default web browser but Internet Explorer or Edge. Go figure. Spotted on more than several occasions on different machines at random points of time
  • It does nothing on some machines
  • It fails on .NET Core

The Solution

Gapotchenko.FX.Diagnostics.WebBrowser module provides WebBrowser class with a single Launch method.

A pure joy to use that comes without aforementioned drawbacks of the Process.Start(…) method:

using Gapotchenko.FX.Diagnostics;

WebBrowser.Launch("https://example.com/");

Usage

Gapotchenko.FX.Diagnostics.WebBrowser module is available as a NuGet package:

PM> Install-Package Gapotchenko.FX.Diagnostics.WebBrowser

Other Modules

Let's continue with a look at some other modules provided by Gapotchenko.FX:

Or look at the full list of modules.