News

With .NET 6 RC 2 Release, Developers Push Back on C# Changes

Microsoft shipped the second production-ready Release Candidate for its groundbreaking .NET 6 release, which unifies various components into one umbrella offering that can be used for all types of development for all types of targets and platforms.

Yet, with only one month to go before General Availability status, some developers are pushing back on new features and functionality in comments to the announcement post, piling on earlier negative feedback provided to the dev team.

The post was written by Richard Lander, program manager, .NET Team, who focused on detailing what's new in .NET 6 for C# 10 in general because all the major new features have already been introduced and explained. In recent posts he has focused on one major topic, that being C# now. However, the post generated more than 50 comments from developers, several of whom complained about changes related to C#, especially concerning a new using statement scheme and top-level statements now used in generated templates.

Language features used in the new templates include:

  • async Main
  • Top-level statements
  • Target-typed new expressions
  • Global using directives
  • File-scoped namespaces
  • Nullable reference types

In addition to those aforementioned comments (52 as of this writing), Lander implied that the dev team heard from others who expressed similar concerns.

"We modernized .NET SDK templates with Preview 7, using the latest C# features and patterns," Lander said. "There was significant feedback on those changes, in part because builds started to fail." That feedback was addressed by making new features like implicit usings opt-in instead of being enabled by default, but there was more criticism noted.

"There was also feedback that some folks didn't like the new simplified Program.cs file, with top-level statements. We've made improvements to top-level statements in response and continued to use it for templates. We expect that most developers who prefer the traditional approach can straightforwardly add the extra ceremony themselves."

But that didn't sit well with one commenter, who replied: "This is just a lie, no improvements were made upon the backlash, you just continued to defend what was not liked. The second sentence is a big f… y.. to all who voiced valid concerns over it."

Microsoft documentation says "Top-level statements enable you to avoid the extra ceremony required by placing your program's entry point in a static method in a class."

New guidance on "New C# templates generate top-level statements" shows how the generated templates are shrunk from this:

A Traditional Generated Console Template
[Click on image for larger view.] A Traditional Generated Console Template (source: Microsoft).

to this:

The Generated Console Template in .NET 6
[Click on image for larger view.] The Generated Console Template in .NET 6 (source: Microsoft).

Yet along with that simplification came other changes that some developers don't approve of for various technical reasons. In more easily understood terms, one developer argued that the older, larger generated templates made it easier to understand what was going on.

Another said: "I can't understand why Microsoft and people who contribute to C# and .NET create 'features' which are not needed. Beginners and professionals don't need top-level statements and these new default templates with hidden Program class."

However, several developers weighed in positively with the changes Microsoft has made, with comments such as:

  • 1. I love those features. 2. You don't have to use them.
  • I like top-level statements in most cases!
  • I am a big fan of the top-level statements

In many ways, the debate echoed the give-and-take that ensued with .NET 6 Preview 7 in August, where top-level statements spurred both negative and positive comments. Lander explained and defended the dev team's moves then and in the new post.

In response to the developer who preferred the larger traditional generated templates because they made it easier to understand what was going on, Lander replied:

I can only say that the design team disagrees. We don't think beginners need to learn these things. They don't for a lot of the other popular languages. The model you've shown is the C language model. There are other models. Rust, Go, and Swift all do it differently than C#.

I remember trying to teach my kids C# when they were young. It was way too much information to get started. I almost switched to teaching them JavaScript instead so that I could start with just a single line of code.

Otherwise, beyond the renewed debate about top-level statements and other complaints, Lander noted other positive feedback from developers who put RC 1 through its paces, saying he expects that to continue.

"We've heard from users that upgrading production sites to .NET 6 RC1 has been both 'boring' (non-event) and 'exciting' (significant performance improvements)," he said. "We're confident that RC2 will continue that trend of having no surprises and exciting results."

.NET 6 will be a long-term support (LTS) release, enjoying full support for three years:

The .NET Release Cadence
[Click on image for larger view.] The .NET Release Cadence (source: Microsoft).

A high-level look at where .NET is going is provided in the Themes of .NET site:

Themes of .NET
[Click on image for larger view.] Themes of .NET (source: Microsoft).

Lander said many new features in .NET 6 only come fully together near the end of the dev cycle, with the team now mostly validating end-to-end workflows to find any problems or issues. "That's led to teams tightening leaky pipes and paving paths all the way to their destination," he said.

Some other points to note from Lander:

  • .NET 6 RC2 has been tested and is supported with Visual Studio 2022 Preview 5, also releasing today [Oct. 12].
  • .NET 6 will launch at .NET Conf November 9-11.
  • Some Microsoft teams have gone into production on RC1 and we expect many more on RC2. This includes the .NET Website.
  • Visual Studio 2022 for Mac is currently NOT compatible with .NET 6 RC2. We are in the process of resolving that.

The lengthy post also goes into detail about other template changes and many other topics, including a rundown on problems the dev team has faced in providing support macOS and Windows arm64, which has been more than a year in the making and now "is almost done."

What do you think about the changes Microsoft is making in .NET 6, especially concerning top-level statements, revamped templates and other topics in the post? Please share your thoughts in the comments section!

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

Upcoming Events