.NETpad Resurrections (Premium)

With .NET 6 now available, I’ve been looking over the four versions of .NETpad that I created a few years back to see how they can be modernized. There are some obvious strategies. And some obvious roadblocks too.

As a reminder, I wrote four versions of .NETpad: the original version with Windows Forms, Visual Basic.NET, and the .NET Framework; a second version with Windows Forms, C#, and the .NET Framework (which I never documented), a version using the Windows Presentation Foundation (WPF), C#, and .NET Core 3.1, and a Universal Windows Platform (UWP) version with C#. Each is, in its own way, pretty memorable, and each has its charms … and its deficiencies, some related to the underlying technology and some to my own inexperience.

The most recent of those versions dates back to the first half of 2020. Since then, I’ve debated where to go next. I’ve researched Microsoft technologies, web technologies like React and React Native, and third-party solutions like Google Flutter. I’ve watched as Microsoft followed up .NET Core 3.1 with .NET 5 and then, more recently, .NET 6. I’ve waited to see what happened with Project Reunion, which has finally shipped as the Windows App SDK, and .NET MAUI, which will be finalized by mid-2022.

In mid-2021, I thought I had the answer in Blazor, a set of web technologies based on .NET and C#. And in the June 14 issue of the Thurrott Premium newsletter, I wrote an editorial, “Create,” I explained my choice.

So what happened?

Simple: Windows 11 happened, upending these and other series I had planned. I downloaded the first leaked version of Windows 11 the day after I wrote about Blazor and used it full-time on a trip to Mexico City before Microsoft officially unveiled the new platform on June 24. Windows 11 consumed me for the rest of 2021, in part because I had a major new book to write—so much for the tiny Windows 10 21H2 update I was expecting—and in part because Microsoft decided to ship Windows 11 less than three months after it was first announced. Windows has always been at the center of everything I do, and so I pretty much dropped everything else.

Over the holiday 2021 break, however, I started thinking about the projects I had set aside, and about how I might manage my time a little better. The first step was to fire up the long-overdue second half of my epic Programming Windows series. Other steps include figuring out future programming projects—the subject of this article—and my also-overdue exploration of Linux, which I will also start soon.

I’ve been looking over my .NETpad projects and I re-read a good chunk of the first Windows Forms series I wrote. And I have to say, it’s pretty special. It was written with a bit of faith that I could get up to speed quickly—I was a “professional” programmer of sorts at one point in my career, but those days are long over and I’d never seriously worked with .NET before—and that readers would get me over past some obstacles. And it was such a great, collaborative experience. You can really see it in the ups and downs, do-overs, and in the final product(s). I like that I was able to add features that the original Notepad doesn’t have, and while there are a very small number of esoteric features no version of .NETpad supports (like its support for various encoding formats), the apps I created—we created—are pretty cool.

Were I to do this over again, I’d make some changes, of course. I never should have wasted my time with a Visual Basic version of the application, for example, and I wish I had used .NET Core instead of the legacy .NET Framework since the upgrade to .NET 6 would be much, much easier. But I had my reasons for both choices, and if you think back to that time, I had just run into the .NET era in that Programming Windows series and wanted to get up to speed on the first major Microsoft programming environment of that timeframe. So there’s no use worrying about it now.

At some point, I archived my four .NETpad versions in GitHub, another technology I don’t know enough about. I’ve promised to make the code available publicly, and I will still do so after I’ve discussed this with Rafael to make sure I do it correctly. But for the past several months, I’ve also been working with these codebases on various PCs, seeing what the process is like getting them into Visual Studio and spinning them up again in Windows 11. And I have ideas. Maybe the code I will make available will be improved versions of each app. Modernized versions.

Maybe. One thing I want to avoid is spending too much time on any one project. I still want to move on to other technologies, like those mentioned above—I’m particularly interested in Blazor, the Windows App SDK, and .NET MAUI—and I would like to create smaller projects in other technologies like Microsoft Power Apps, the Uno Platform, and Flutter. Ideally, I can move to a different project each month, though that might be a bit aggressive.

To start, however, I’d like to update and modernize .NETpad. Not every version, of course, but given that I’m now writing about the .NET era in the Programming Windows series, I think it makes sense to start with Windows Forms and then move on to WPF as my coverage of the history of the .NET era continues. No promises on UWP, but we’ll see.

I’m not going to bother with the Visual Basic version of .NETpad. Instead, I’ve been focusing on the C# version, which I feel is superior. But it’s also a bit problematic since I never published a guide to creating that version. So I’ll need to figure that out first. Perhaps by simply releasing it via GitHub.

Next, I would like to modernize the app. And the first step there is to get it converted from the .NET Framework to .NET 6. Unfortunately, this process is hairy, and though Microsoft provides a free upgrade tool, I’ve never gotten it to work successfully. So I will need to either figure that out or simply publish a new .NET 6 version of the Windows Forms version of .NETpad.

Once that is done, there are all kinds of ways we could modernize this app. The new Windows 11 version of Notepad is an obvious reference point since it provides a modern WinUI-based user interface a slightly revised menu system and a new settings interface. In fact, I’ve already sort of duplicated most of that using WinForms, which isn’t really ideal for this kind of work:

(Some kind of WinUI update would make even more sense, but I’m still not there yet.)

But there are other possible changes. When I was originally creating .NETpad, Microsoft’s Windows Forms interface for a feature called the Task Dialog had silently disappeared years earlier, so I recreated this interface using a custom dialog and then a customized Message Box. But in the new .NET 5+ era, Microsoft has started improving Windows Forms again. And guess what? Task Dialog is back! I’ve already worked up a quick prototype to prove it can work:

I would also like to implement some features I’d planned years ago, most notably location awareness, where the application could adapt to different languages on the fly. Today, all of the text strings in the app are hard-coded (and are, of course, US English).

I don’t think I’ll be able to get all of that done in a month. But I’ve already started working on it, and we’ll see where it takes us. And then we’ll move to other programming projects in succession.

More soon. But if you have any ideas about .NETpad or other programming projects you’d like to see, please let me know. I’d like to really branch out and door along these lines in 2022. Thanks!

Gain unlimited access to Premium articles.

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.

Tagged with

Share post

Thurrott