Questions tagged [.net-6.0]

For questions about Microsoft's .NET application development framework that are specific to version 6.0+ of the framework. Use only If your question are version-specific

For the original announcement of .NET 6, and for more detailed information, please refer to the official communication from Microsoft.


.NET 6 delivers the final parts of the .NET unification plan that started with .NET 5. .NET 6 unifies the SDK, base libraries, and runtime across mobile, desktop, IoT, and cloud apps.

is the next big release to the .NET family after .NET 5.

was released November 8th, 2021.

The first preview was made available on February 17th, 2021.

General Improvements :

In addition to this unification, the .NET 6 ecosystem offers:

  • LTS Release: .NET 6 is Supported for three years as the latest long term support (LTS) release.

  • Simplified development : Getting started is easy. New language features in C# 10 reduce the amount of code you need to write. And investments in the web stack and minimal APIs make it easy to quickly write smaller, faster microservices.

  • Better performance : .NET 6 is the fastest full stack web framework, which lowers compute costs if you're running in the cloud.

  • Ultimate productivity : .NET 6 and Visual Studio 2022 provide hot reload, new git tooling, intelligent code editing, robust diagnostics and testing tools, and better team collaboration.


Whats New :

  • C# 10 : All new C# 10 offers language improvements such as record structs, implicit using, and new lambda capabilities, while the compiler adds incremental source generators.

  • F# 6 : F# 6 adds new features including Task based async, pipeline debugging and numerous performance improvements.

  • Minimal APIs : Simplify getting started experience and HTTP services performance improvement.

  • Hot Reload : This feature enables you to skip rebuilding and restarting your app to view a new change — while your app is running — supported in Visual Studio 2022 and from the .NET CLI, for C# and Visual Basic.

  • .NET MAUI : .NET Multi-platform App UI (.NET MAUI) is still in preview, with a release candidate coming in the first quarter of 2022 and general availability (GA) in the second quarter of 2022. .NET MAUI makes it possible to build native client apps for desktop and mobile operating systems with a single codebase.

  • Blazor : ASP.NET Core in .NET 6 improves Blazor. Blazor components can now be rendered from JavaScript and integrated with existing JavaScript based apps.

  • File IO : File IO in .NET 6 has support for symbolic links and has greatly improved performance with a re-written-from-scratch FileStream.

  • Production stress-tested : Production stress-tested with Microsoft services, cloud apps run by other companies, and open source projects.

  • HTTP/3 : .NET 6 includes preview support for HTTP/3, a new version of HTTP. HTTP/3 solves some existing functional and performance challenges by using a new underlying connection protocol called QUIC. QUIC establishes connections more quickly, and connections are independent of the IP address, allowing mobile clients to roam between Wi-fi and cellular networks. For more information, see Use HTTP/3 with HttpClient.

Offical Links

5513 questions
18
votes
1 answer

How To Resolve Error: Required properties '{'Prop1', 'Prop2'}' are missing for the instance of entity type 'SomeType''?

Question: how to resolve this error: Microsoft.EntityFrameworkCore.DbUpdateException: Required properties '{'Prop1', 'Prop2'}' are missing for the instance of entity type 'SomeEntity' with the key value '{Id: 1}' I have a test suite that uses the…
derekbaker783
  • 8,109
  • 4
  • 36
  • 50
17
votes
6 answers

Minimal API in .NET 6 using multiple files

In .NET 6 it is possible to create minimal APIs: var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); app.MapGet("/products/{id}", (int id) => { return Results.Ok(); }) app.MapGet("/users/{id}", (int id) => { return…
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
17
votes
5 answers

How to calculate sha 512 hash properly in .NET 6

In .NET 6 code from How can I SHA512 a string in C#? var data = Encoding.UTF8.GetBytes("key"); byte[] hash; using (SHA512 shaM = new SHA512Managed()) hash = shaM.ComputeHash(data); Throws warning Warning SYSLIB0021 'SHA512Managed' is…
Andrus
  • 26,339
  • 60
  • 204
  • 378
17
votes
1 answer

Integration test and hosting ASP.NET Core 6.0 without Startup class

To setup unit tests in previous versions of .Net Core, I could host my WebApp or WebAPI in a test project the following way: IHost host = Host.CreateDefaultBuilder() .ConfigureWebHostDefaults(config => { …
user2341923
  • 4,537
  • 6
  • 30
  • 44
16
votes
4 answers

MinimalAPI - Did you mean to register the "Body (Inferred)" parameter(s) as a Service or apply the [FromService] or [FromBody] attribute?

I created an asp.net core empty project and whenever I am trying to run my application it gives me the error shown below. I cannot even hit the end point as soon I hit play it gives the…
MarkCo
  • 810
  • 2
  • 12
  • 29
16
votes
1 answer

.NET 6 failing at Decompress large gzip text

I have to decompress some gzip text in .NET 6 app, however, on a string that is 20,627 characters long, it only decompresses about 1/3 of it. The code I am using code works for this string in .NET 5 or .NETCore 3.1 As well as smaller compressed…
Xaphann
  • 3,195
  • 10
  • 42
  • 70
16
votes
2 answers

Host ASP (.NET 6) in a Windows Service

I am currently hosting an ASP.NET (.NET 5) application in a Windows Service using WebHost and WebHostBuilder. .NET 6 introduced WebApplication and WebApplicationBuilder. How can I use these to host in a Windows Service?
Sandy
  • 1,284
  • 2
  • 14
  • 32
16
votes
1 answer

.NET 6 does not support .NET Standard 2.1?

I just updated a project from .NET 5 to .NET 6. It compiles and runs perfectly locally. When I push this to azure, running my CI pipeline, an error is reporting that: NU1202: Package MyStandardPackaged 1.0 is not compatible with net60…
Leonardo
  • 10,737
  • 10
  • 62
  • 155
16
votes
2 answers

Get Configuration value from IHostBuilder in Net 6

I am creating a Worker application using Net 6 and I have in Program.cs: IHostBuilder builder = Host.CreateDefaultBuilder(args); builder.ConfigureHostConfiguration(x => { x.AddJsonFile("settings.json", false, true); …
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
16
votes
3 answers

.NET 6 IntersectBy and ExceptBy examples

Could someone provide me a small example on how to Use the .NET 6 LINQ IntersectBy and ExceptBy methods? MSDN hasn't got any examples and the one I tried doesn't compile due to CS0411 error. The example I tried: namespace Test { internal struct…
webmaster442
  • 231
  • 1
  • 3
  • 9
16
votes
2 answers

.NET 6.0 Blazor Server app: WebSocket connection to 'ws://localhost:60908/BlazorApp1/' failed

When I create a new, clean Blazor .NET 6.0 app and start it (using Visual Studio 2022), I see the following error in the browser console: WebSocket connection to 'ws://localhost:60908/BlazorApp3/' failed: (aspnetcore-browser-refresh.js:234) Does…
Mcanic
  • 1,304
  • 16
  • 22
16
votes
1 answer

.NET Core 3.1 v .NET 6.0

I got all excited on the release of Visual Studio 2022, C# 10 and .NET 6.0 and downloaded and installed the community edition and tested a project I am working on. I changed the target framework to 6.0 and performed a clean build. Great, everything…
Muz
  • 289
  • 1
  • 3
  • 11
15
votes
2 answers

Is there a dialog for saving files in .NET MAUI?

.NET MAUI provides a FilePicker to show a native Dialog where you can pick a file from the device. Is there a way to show a dialog for saving files? (where you can select a path and enter an filename, ...). I didn't find anything in the .NET MAUI…
Daniel
  • 243
  • 3
  • 8
15
votes
2 answers

.NET 6 (stable) IConfiguration setup in Program.cs

This appears to be a similar problem but none of the answers are fitting for my code...: Read appsettings.json in Main Program.cs This is extremely similar but does not work for me for some reason: ASP.NET Core 6 how to access Configuration during…
Munchkin
  • 857
  • 5
  • 24
  • 51
15
votes
5 answers

Add Swagger description to minimal .NET 6 APIs

I have a small project in .NET 6 that contains minimal APIs like that one app.MapGet("/clients", async (IClientRepository repo) => { var results = await repo.GetClientsAsync(); return…
Enrico
  • 3,592
  • 6
  • 45
  • 102