I like to do my dev work in a virtual machine so that I can keep my host system as clean as possible.
Developers tend to install lots and lots of alpha and beta level libraries, frameworks, SDKs, and just about anything else we can get our grubby little mits on.
That inevetably leads to system destabilization and a death spiral which inexorably degrades into the collapse of civillization as we know it. Well maybe not that bad, but pretty darned bad.
The only true fix is to start anew with a fresh install of the OS. A pain with your host system, a bit less painful with a VM.
For a while I've been using a Windows 11 VM hosted in Hyper-V. Fun fact the Windows 11 installer says it can't run on my desktop hardware. Yet it happily runs in a VM on that same hardware.
The main draw for me sticking with Windows is gaming, I'm not going to lie. The other day I tried to fire up Cyberpunk 2077 and couldn't because of a lack of RAM. Yada, yada, yada, my dev VM had to be shut down.
What Ever Shall I Do?
My first thought was to switch to Linux. See Developing with dotnet on Fedora for more of my thoughts on dotnet and Linux.
Then it hit me. WSL 2 is a Linux VM.