A First Look at Visual Studio 2022

Visual Studio is the primary tool used by most software developers who use the Microsoft technology stack — C#, .NET, Azure, etc. Some of my colleagues prefer to use the Visual Studio Code tool instead of Visual Studio.

I’ve been using VS 2019 for the past few years. I noticed that Visual Studio 2022 had been released so I figured I’d install it. Even though my company has a license for the full Enterprise versions of VS, I use the free Community version. An Internet search led me to a link to download VS 2022 Community. The download was quick, and then installation went without trouble. VS installs can be side-by-side so I didn’t have to uninstall my VS 2019.


Visual Studio 2022 Community edition looks the same as VS 2019.

I coded up a quick demo. I refactored a Python program that used probit regression to create a binary classifier into the C# language running on .NET Core. The program worked as expected.

One new feature of VS 2022 irritated me. When I created a new Console Application, the default library is .NET (Core) 6.0 rather than 5.0 used for VS 2019. The default code template for 5.0 is:

using System;
namespace RunsTestSim
{
  internal class Program
  {
    static void Main(string[] args)
    {
      Console.WriteLine("Hello World!");
    }
  }
}

Makes sense. Entry point is Main() inside a Program class and looks very much like the console application template for the last 20 years. But the default console application template for .NET 6.0 is:

// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

What. The. Heck.

The documentation reads “The compiler synthesizes a Program class with a Main method and places all your top level statements in that Main method. You don’t need to include the other program elements, the compiler generates them for you.”

How can anyone on the VS team think is this useful? I don’t like magic invisible code generation. I wear my big boy coding pants and can write code. Sheesh.

I’ve been using VS since the first .NET release in 2000. Early on, each new version of VS had many significant new features. But VS has been stable for quite some time and so there are fewer reasons to upgrade. But, there aren’t many reasons not to upgrade either.

I think it’d be difficult to work on the team that is responsible for creating VS. Your job performance is based to a large extent on creating new and useful features. But with a product like VS that is so mature, there’s inevitably an urge to create new features that nobody has asked for and nobody wants. This is in contrast to the world of machine learning where exciting new ideas and algorithms emerge frequently.

The ever-increasing bloat of Visual Studio was one of the main reasons why the lightweight Visual Studio Code tool was created. However, over time, Visual Studio Code has become a monster too.



Even though Visual Studio is arguably bloated with features, I still like it a lot. In science fiction movies, bloated villains are never good. Left: Jabba the Hut, a crime lord on the planet Tatooine, in “Return of the Jedi” (1983). Center: One of several evil mutants from “Spacehunter: Adventures in the Forbidden Zone” (1983), a movie that’s much better than you might expect. Right: Baron Vladimir Harkonnen, from “Dune” (1984).


A key C# function from my probit regression demo:

static double ComputeOutput(double[] x, double[] wts, double bias)
{
  double z = 0.0;
  for (int i = 0; i < x.Length; ++i)
    z += x[i] * wts[i];
  z += bias;
  return Phi(z);
  // return Sigmoid(z);  // logistic sigmoid
}
This entry was posted in Machine Learning. Bookmark the permalink.

4 Responses to A First Look at Visual Studio 2022

  1. Thorsten Kleppe's avatar Thorsten Kleppe says:

    I really like the spartan way much more than the old way with a main method (but we can use both).

    Before that I create on top a print function which is shorter to write and helps to translate the code easier into other languages.

    System.Action print = System.Console.WriteLine;
    print (“Hello, World!”);

    VS 2022 is so far the fastest VS with .Net 6, so many ML projects in C# will benefit from this.

  2. tillig's avatar tillig says:

    To be clear, and you did mention it, the new Console app template with no Main method isn’t a VS feature so much as a .NET Core feature. VS just uses what the .NET team provides. Apparently there is a non-trivial portion of the .NET community that wants to remove “boilerplate” by taking away some of the explicit things like the Program.Main bits.

    ASP.NET has also gone this way, where a lot of the “boilerplate” stuff has been removed in an effort to simplify, but I always have to unwind the simplifications back into explicit pieces because I’m writing more complex things than the simplified “no boilerplate” mechanisms provide for.

    I’m in your boat, though, and really kinda hate these new templates. It’s frustrating that it’s not an option – I can’t “opt in” to getting the more explicit templates.

  3. tillig – You make the point I should have but didn’t — I’d like to see a checkbox during Project creation that allows you to use the classic style template instead of the new template. Also, it is possible (and easy) to create custom templates, but that shouldn’t be necessary.

  4. kuldeepmasso's avatar kuldeepmasso says:

    If there is an error in the .net runtime optimization service, then it becomes troublesome to launch apps or play games on your desktop. In case none of the above methods work in fixing the error, you can always temporarily deactivate the .Net optimization service. Doing this will not affect your NET framework but will prompt you to do a few repairs to it.

Comments are closed.