
When I made the C#/Windows Forms version of .NETpad available on GitHub in late January, I wasn’t sure what to expect. To my surprise, outsiders have proposed some useful fixes and changes, and I’ve even approved a few of them, adding them into the master repository. And to my horror, I belatedly realized that this version of .NETpad is a bit rough from a code quality standpoint, and that I should have spent some time cleaning that up before it went live.
Ah well. You live, you learn. Here’s where we’re at.
This is an astonishing thing to admit, but I didn’t really look at the code for this version of the app too closely before I made it available to the public on GitHub. That was a mistake. I had created this version quickly, and I never documented it on Thurrott.com, and it would have benefitted from a few days of code review.
There are issues, some of which I find embarrassing. The code is rarely commented in any way, mostly because it was a quick and dirty port of the original Visual Basic version to C#. And I originally intended to add some new features to this C# version, to differentiate it a bit from the VB original. (That may be why it still uses a RichTextBox instead of a TextBox: I do recall considering adding a rich text mode and perhaps making it more like WordPad.) Ultimately, I ended up moving on to the Windows Presentation Foundation (WPF) version of the app. And that version is indeed more sophisticated.
Anyway. It is what it is. I’ll be more careful with the next version. And I may still spend some time cleaning up the code for this version regardless.
As noted, I wasn’t sure what to expect when I posted this version of .NETpad on GitHub. But to my horror and delight, a small number of GitHub users have forked .NETpad, creating their own local versions to play with. And some have even submitted pull requests, which are code changes they’ve made that they’re requesting be added to the master repository.
There have been 6 pull requests so far, and I’ve accepted two of them, meaning that those changes were merged into the master repository. Anyone who uses Visual Studio to clone this repository now will get the updated version of the apps with the new pull requests integrated. And anyone who cloned it previously can update their code via Visual Studio too: just open the Git Changes tab in the Solution Explorer and choose “Pull.” (It’s the downward-facing arrow.)

The two pull requests I’ve accepted are:
The FileOk event had lost its handler. This fixes a bug in my Save As code.
Remove the annoying beep from the text box when navigating past it’s … This one fixes an interesting problem: if you use the arrow keys to navigate around the text in the app’s TextBox and try to navigate past the end of the text, you’ll hear a “bong” error sound. With this change, that sound no longer plays. What makes it interesting is that this bug is present in some versions of Notepad, too. But we don’t have to be that faithful.
As for the four remaining pull requests, I’ll probably approve/merge at least some of them. One, called “Allow text drag and drop from other applications,” seems reasonable (and I support that in at least some .NETpad versions). But another, called “Significantly faster word count calculation,” doesn’t seem all that important, as the existing word count calculation is fast enough, and it’s not like you can type too fast to overwhelm it.
But I’m uncertain about the last two, both of which tackle complex subjects I was hoping to take on myself. One is called “Migrate to .NET 6,” and it migrates .NETpad from the classic .NET Framework to the newer .NET 6. I’ve tried to do this myself and failed, using Microsoft’s .NET Upgrade Assistant, but the truth is, this migration is probably unnecessary. The other, “Translation support,” adds localization support to the app and even includes Swedish translations for all of the previously hardcoded text in the app. That’s impressive, but it may be a bit much. I’m thinking about creating a new app from scratch that is localization-aware. We’ll see.
As for improving/modernizing .NETpad, I’m starting to think that we’re better off doing so with the more sophisticated WPF version of the app. But that doesn’t mean there aren’t some changes to make here first.
Starting with bug fixes. I’ve identified some issues I’d like to fix:
Status bar. It’s still not quite right, despite my efforts to fix this before posting to GitHub.
Saving maximized window state. If you maximize the app window and then close it and restart it, the app size and position are off (because this feature is unaware of the maximized state).
Text paste bug. When you paste text into the app, the position (Ln, Col) display doesn’t update.
Themes bugs. I need to update the theme menu items to correctly identify which theme and/or custom text and background colors are selected.
And then I have a few ideas for modernizing the app:
Updated fonts. Switch to the new Windows 11 font everywhere.
Task Dialogs. The real Notepad uses Task Dialogs instead of Message Boxes for its Save prompts. This isn’t strictly necessary, but I think I can use real Task Dialogs now.
Visual update. Notepad is about to get a modern makeover in Windows 11. And while it’s not possible to fully emulate this with Windows Forms, we can get it at least partially there. I think a more complete job can be completed with WPF.
I’d like to complete any updates by the end of February so we can move on to something else. So let me start with some code cleanup and bug fixing, and then I’ll look at which of the modernization tasks make the most sense. And I’ll see about accepting a few more pull requests too.
More soon.
With technology shaping our everyday lives, how could we not dig deeper?
Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.