Cross-platform diagnostic tools for .NET Core

.NET Core is cross-platform and open-source. Tell someone, maybe your boss.

A good reminder. It's been this way for a half decade but I'm still bumping into folks who have never heard this. Moving forward, .NET 5 will be a unification of the .NET Framework you may have heard for years, and the new .NET Core I like talking about, PLUS great goodness, tools and libraries from Mono and Xamarin. It's one cross-platform .NET with a number greater than 4. Because 5 > 4, natch.

NOTE: If you like, you can learn all about What is .NET? over on my YouTube.

Now you've made some software, maybe for Windows, maybe Mac, maybe Linux. There's a lot of ways to diagnose your apps in .NET Core, from the Docs:

  • Logging and tracing are related techniques. They refer to instrumenting code to create log files. The files record the details of what a program does. These details can be used to diagnose the most complex problems. When combined with time stamps, these techniques are also valuable in performance investigations.
  • Unit testing is a key component of continuous integration and deployment of high-quality software. Unit tests are designed to give you an early warning when you break something.
  • Debug Linux dumps explains how to collect and analyze dumps on Linux.

But I want to talk about the...

.NET Core Diagnostic Global Tools

First, let's start with...


dotnet tool install --global dotnet-counters

Now that I've installed it, I can see what .NET Core apps I'm running, like a local version of my Hanselminutes podcast site.

dotnet counters ps

18996 hanselminutes.core D:\github\hanselminutes-core\hanselminutes.core\bin\Debug\netcoreapp3.1\hanselminutes.core.exe
14376 PowerLauncher C:\Program Files\PowerToys\modules\launcher\PowerLauncher.exe
24276 pwsh C:\Program Files\PowerShell\7\pwsh.exe

I also see PowerShell 7 in there that I'm running in Windows Terminal. Pwsh is also written in cross platform .NET Core.

I'll run it again with a process id, in this case that of my podcast site:

dotnet counters monitor --process-id 18996

Here I'll get a nice constantly refreshing taskman/processmonitor of sorts in the form of dotnet-countersperformance counters:


Again this works outside Visual Studio and it works everywhere. You can watch them and react, or collect them to a file.


The dotnet-dump tool is a way to collect and analyze Windows and Linux core dumps without a native debugger. Although it's not yet supported on macOS, it works on Windows and Linux.

With a similar syntax, I'll dump the process:

dotnet dump collect -p 18996

Writing full to D:\github\hanselminutes-core\hanselminutes.core\dump_20200918_224648.dmp

Then I'll start an interactive analysis shell session. You can run SOS (Son of Strike) commands to analyze crashes and the garbage collector (GC), but it isn't a native debugger so things like displaying native stack frames aren't supported.

dotnet dump analyze .\dump_20200918_224648.dmp

Loading core dump: .\dump_20200918_224648.dmp ...
Ready to process analysis commands. Type 'help' to list available commands or 'help [command]' to get detailed help on a command.
Type 'quit' or 'exit' to exit the session.

There's tons to explore. Debugging production dumps like this is a lost art.

Exploring in dotnet dump

You can also do live Garbage Collector dumps with


GCDump is:

"a way to collect GC (Garbage Collector) dumps of live .NET processes. It uses the EventPipe technology, which is a cross-platform alternative to ETW on Windows. GC dumps are created by triggering a GC in the target process, turning on special events, and regenerating the graph of object roots from the event stream. This process allows for GC dumps to be collected while the process is running and with minimal overhead."

Once you have a dump you can analyze it in Visual Studio or PerfView on GitHub.


Sometimes you may capture a dump from one machine and analyze it on another. For that you may want to download the right symbols to debug your core dumps or minidumps. For that you'll use


This is great for Linux debugging with lldb.

"Running dotnet-symbol against a dump file will, by default, download all the modules, symbols, and DAC/DBI files needed to debug the dump including the managed assemblies. Because SOS can now download symbols when needed, most Linux core dumps can be analyzed using lldb with only the host (dotnet) and debugging modules."

Interesting in some real tutorials on how to use these tools? Why not learn:

In the next blog post I'll look at dotnet trace and flame graphs!

Sponsor: Have you tried developing in Rider yet? This fast and feature-rich cross-platform IDE improves your code for .NET, ASP.NET, .NET Core, Xamarin, and Unity applications on Windows, Mac, and Linux.

© 2020 Scott Hanselman. All rights reserved.

What is the cloud? Explained

I'm continuing my "Computer Stuff They Didn't Teach You" series on YouTube. Please subscribe! I've set a personal goal to get to 100k subs by Christmas.

This episode is very special as it features a Surface Duo *AND* a 1U Rack-Mounted Azure Stack Edge! It's a gentle and clear explanation of cloud computing.

This 20 min video talks about the components of a computer, starting with a Raspberry Pi, Laptops, Phones, Desktops, then moving up to a massively powerful Azure Stack Edge rack mounted device, until finally talking about the Cloud itself. It consists of millions and millions of computers all working together to make the world turn.

You may know all these things BUT you may also enjoy some of the analogies to explain to non-technical partner how the cloud works as well as "what exactly it is you do!?"

I hope you enjoy watching it as much as I enjoyed making it! Go subscribe now!

Sponsor: Never miss a beat with Seq. Live application logs and health checks. Download the Windows installer or pull the Docker image now.

© 2020 Scott Hanselman. All rights reserved.

How to use a Raspberry Pi 4 as a Minecraft Java Server

imageMy 14 year old got tired of paying $7.99 for Minecraft Realm so he could host his friends in their world. He was just hosting on his laptop and then forwarding a port but that means his friends can't connect unless he's actively running. I was running a Minecraft Server in a Docker container on my Synology NAS but I thought teaching him how to run Minecraft Server on a Raspberry Pi 4 we had lying around would be a good learning moment.

First, set up your Raspberry Pi. I like NOOBS as it's super easy to setup. If you want to make things faster for setup and possibly set up your Pi without having to connect a monitor, mouse, or keyboard, mount your SSD card and create a new empty file named ssh, without any extension, inside the boot directory to enable ssh on boot. Remember the default user name is pi and the password is raspberry.

SSH over to your Raspberry Pi. You can use Putty, but I like using Windows 10's built-in SSH. Do your standard update stuff, and also install a JDK:

sudo apt update

sudo apt upgrade
sudo apt install default-jdk

There are other Minecraft 3rd party Java Servers you can use, the most popular being Spigot, but the easiest server you can run is the one from Minecraft themselves.

Go to in a browser. It'll say something like "Download minecraft_server.1.16.2.jar and run it with the following command." That version number and URL will change in the future. Right-click and copy link into your clipboard We are going to PASTE it (right click with your mouse) after the "wget" below. So we'll make a folder, download the server.jar, then run it.

cd ~

mkdir MinecraftServer
cd MinecraftServer
java -Xmx2500M -Xms2500M -jar server.jar nogui

You'll get a warning that you didn't accept the EULA, so now open "pico eula.txt" and set eula=true, then hit Ctrl-X and Yes to save the new file. Press the up key and run your command again.

java -Xmx2500M -Xms2500M -jar server.jar nogui

You could also make a text file with pico then chmod +x to make it an easier single command way to start your server. Since I have a Raspberry Pi 4 with 4g gigs of RAM and it'll be doing just this one server, I felt 2500 megs of RAM was a sweet spot. Java ran out of memory at 3 gigs.

You can then run ifconfig at and command line and get your Pi's IP address, or type hostname to get its name. Then you can connect to your world with that name or ip.

Running Minecraft Servers

Performance Issues with Complex Worlds

With very large Minecraft worlds or worlds like my son's with 500+ Iron Golems and Chickens, you may get an error like

[Server Watchdog/FATAL]: A single server tick took 60.00 seconds (should be max 0.05)

You can workaround this in a few ways. You can gently overclock your Pi4 if it has a fan by adding this to the end of your /boot/config.txt (read articles on overclocking a Pi to be safe)



And/or you can disable the Minecraft internal watchdog for ticks by setting max-tick-time to -1 in your server's file.

We solved our issue by killing about 480+ Iron Golems with

/kill @e[type=minecraft:iron_golem]

but that's up to you. Just be aware that the Pi is fast but not thousands of moving entities in Minecraft fast. For us this works great though and is teaching my kids about the command line, editing text files, and ssh'ing into things.

Sponsor: Never miss a beat with Seq. Live application logs and health checks. Download the Windows installer or pull the Docker image now.

© 2020 Scott Hanselman. All rights reserved.

Synology DS1520+ is the sweet spot for a home NAS and a private cloud

61fje6GaYKLMy long love of Synology products is well-documented. I checked my Amazon history, and I bought my Synology DS1511+ NAS in May of 2011! I have blogged about the joy of having a home server over these last nearly 10 years in a number of posts.

It's great to have a home server - it's a little slice of the cloud, in your home. I like home servers because while I trust the cloud, I trust a computer I can touch about 1% more than someone else's computer.

NOTE: When I review gadgets and products, I often use Amazon Affiliate Links. I donate the small amount I make from you using these links, Dear Reader, to my kids' charter school. Thanks for using and clicking these links to support!

Anyway, my Synology DS1511+ is about ten years old and it's working great but I am using it more and more and throwing more and more at it. It did have some challenges running a Minecraft Server recently, on top of all its other responsibilities.

I use Seagate 2TB disks and I run 4 of them in the 5 bay device, with a fifth drive as a hot spare. If a drive goes bad - which happens about every 2 to 3 years - the Synology will rebuild with the spare, then I pull the dead drive. I have two additional 2TB unopened Seagate Drives ready to go, so when this happens it's as close to a non-event as possible.

Synology is amazing

I have every digital photo and digital video and family document we've created since 1998. I've also got local backups of my Gmail from which goes back to before Gmail started when I was running my own POP3 mail server. It's all easily less than 5TB. Remember also that Google Takeout can get you Zips of all your data! Back. It. All. Up!

Twenty years of photographs

Fast forward to today and Synology came out with the Synology 5 Bay NAS DiskStation DS1520+. It's basically a ten year's newer clone of my 1511+ workhorse, updated and refreshed! It's WAY faster. It was immediately noticeable on startup. File access is faster, indexing is faster, my Docker images start faster.

Now, a little more money would get you a 6 bay NAS and just $150 will get you a 2 bay, but I love the size and power of a 5 bay for our home and my office. Four disks are for my array and 1 is that hot swap drive. I think that for small businesses or home offices five bays is the perfect size and price - about $600-700 USD.

The Synology 1520+ has 4 GbE network ports (which is nice with Link Aggregation in a busy house), supports two eSATA externals (I use one to backup the backup to a single disk, as I believe in the Backup Rule of Three and you should, too!) and works with any SATA drives, 2.5" or 3.5". One of the big reasons that attracted me to this update is that there's slots for 2 x M.2 2280 NVMe SSDs for caching. I put a 512G M.2 drive in there to accelerate file system access.

5 Drives in a Synology

If you want, you can have up to 15 drives using two DX517 drive expanders up to 240TB, but with just 4 slots and large drives like Seagate Ironwolf drives in the 10TB to 18TB range, storage is really a non-issue. I use Seagate 2TB drives because they're plentiful and like $50. We treat it like a massive infinite local disk in the house that everyone can talk to. We named it SERVER, so it's just \\SERVsynoER for everyone.

The Synology OS software is deep and broad and runs entirely in your browser. You'll figure it out very quickly as it's all windows and wizards. I am a fan of the Cloud Sync feature that I use to backup my Google Drive, Dropbox, and One Drive. Again, this is a level of paranoia, but damned if I'm gonna get locked out of my own data.

Synology Cloud Sync

The Synology HyperBackup goes in any direction using whatever cloud and whatever tools you are familiar with. You want Rsync? Cool. Want to backup to Azure or AWS? Cool.

Backup to Azure from a Synology

I was concerned that migrating would be hard or involved basically starting over from scratch, but since I was moving between two models in the same family (I was moving from a 1511+ to a 1520+, even 10 years later) It was literally just move the drives in order and boot up. Took 10 minutes. For movement between device families or to new drives there's at least three good options.

It was actually scarily simple, given there's ten years of history here. I moved the drives (maintaining order) and booted up the new 1520+ and was greeted with this screen:

Migrate your Synology

I clicked Migrate twice and was all set.


If you are migrating and upgrading, I'd be sure to read the section on HDD Migration and look closely at the table, considering your Source and Destination NAS models.

So far this new Synology is WAY snappier, runs Docker faster, can run Virtual Machines now (although in 8 gigs, only small utility ones), and the SSD cache has made browsing family photos whip fast. All in all, it feels like a 10 year refresh BUT it's the same size.

SSD Cache in a Synology

My home NAS is sitting quietly on a shelf in my office. The kids and spouse are having their PCs backed up in the background, family photos and DVD backups are all available easily (and there are Synology iPhone apps as well to view the files).

Synology devices specifically - and home NAS devices generally - are a great addition to techie homes. There's a bunch of 1st and 3rd party packages you can run on it to make it as much or little a part of your Home IT setup as you like. It can run DHCP and DNS, iTunes Servers, Mail, Chat Servers, or even their own web-based Office clients. Take a look at the Synology 1520+ if you're in the market for a home or business NAS. I'm looking forward to another 10 years with this NAS.

Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Installs in minutes, try it today!

© 2020 Scott Hanselman. All rights reserved.

It's 2020 and it is time for text mode with Gui.cs

Nearly 16 years ago I complained that Windows is completely missing the TextMode boat. It's 2020 and it's TIME FOR TEXT MODE BABY.

I keep bumping into cool utilities made with Gui.cs. Miguel de Icaza made Midnight Commander (not Norton Commander, but evocative of it) and it's a joy.

Head out to an admin command prompt on your Windows 10 machine now and install it (assuming a recent Windows 10 build, you'll have winget):

winget install GNU.MidnightCommander

You run it with "mc" and even better if you've got Windows Terminal blinged out you'll be able bask in the ASCII COATED GLORY:

Midnight Commander is lovely

It works in WSL as well, since there's a Linux version with "apt install mc" so check that out, too!

Do YOU want to make apps like this? While Midnight Commander wasn't made with Gui.cs, it could have been. I spent YEARS making awesome text mode apps with TurboVision. Now we can make text mode apps with C#! There is even a complete Xterm/Vt100 emulator as well in the form of TerminalView.cs.

Is it hard? Nah! Go "dotnet new console" then "dotnet add package Terminal.Gui" and then copy these lines over the ones that are given you in Program.cs, then "dotnet run". Boom.

using Terminal.Gui;

class Demo {
static int Main ()
Application.Init ();

var n = MessageBox.Query (50, 7,
"Question", "Do you like console apps?", "Yes", "No");

return n;

There you go! You should go read about it now!

Do you like Console Apps?

If you want to see all the cool text controls you can use, check out the Terminal.Gui UI Catalog app and its source code.

Sure, it's not that new-fangled HTML, but let me tell you, you see these apps every day. The airport, the DMV, the mechanic, the doctor's office. Apps like these are FAST. It's useful to know that these kinds of apps'll never know when you might need to get back in to TEXT MODE!

Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Installs in minutes, try it today!

© 2020 Scott Hanselman. All rights reserved.

🤞 More