Host a simple webpage in WinForms with CefSharp

WinForms and the web. Like oil and water, they don’t mix well. But with CEFSharp, they mix a LOT better. Let’s check it out.

  Jun 28, 2022 (rev. Oct 11, 2025) ·  10 min

Mocking MessageBox (or any static class) in WinForms

Unit testing a WinForms app is an uphill battle in the best of times, before you add in classes like MessageBox. Let’s make the best of it.

  Jan 7, 2022 (rev. Oct 11, 2025) ·  4 min

Using nameof to avoid magic strings in C#

There’s a lot of ways to make our code work for us. Let’s check out using the nameof operator to avoid magic strings.

  Dec 30, 2021 (rev. Nov 27, 2025) ·  6 min

How to log errors in WinForms using NLog

Logs are a great tool for squashing bugs and tracing errors. Let’s see how to add NLog to our project.

  Oct 9, 2021 (rev. Oct 11, 2025) ·  5 min

Move a subdirectory into its own Git repo, with history

Need to pull a subdirectory out of repo A and create a new repo B out with it? Including full history and branches? Okay, here’s how.

  Jul 30, 2021 (rev. Oct 11, 2025) ·  2 min

Using MVP to test a WinForms app

If you find yourself supporting a WinForms application, you’re likely to notice the tests… or lack thereof. Just because we may not have been so focused on automated tests and continuous integration when WinForms was younger, that doesn’t mean we can’t introduce them now. Better late than never!

  Jun 9, 2021 (rev. Oct 11, 2025) ·  9 min

Using Async, Await, and Task to keep the WinForms UI responsive

Using the async/await pattern in WinForms is an easy win, helping prevent one of the most annoying user experiences - a frozen UI.

  Jun 7, 2021 (rev. Oct 11, 2025) ·  8 min

What is DotNet Try?

Do you prefer reading or doing? How about both? DotNet Try pulls in C# code from your project and turns your docs into an interactive experience.

  May 29, 2021 (rev. Oct 11, 2025) ·  4 min

What is mocking a dependency?

When you’re writing tests, you generally don’t want to write to the database, email customers, and hit third-party API’s. That’s why we need to know how to mock dependencies!

  Dec 9, 2020 (rev. Oct 11, 2025) ·  8 min

What is a code review / pull request?

Does the idea of submitting to a code review make you sweat bullets? Or do you brush it off as a necessary evil? It should be a (hopefully positive) conversation, wherein the team agrees to the code they’re all going to have to help maintain, and maybe learns something new too.

  Nov 28, 2020 (rev. Nov 2, 2025) ·  9 min