dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.95k stars 4.9k forks source link

What's new in .NET 7 Preview 1 [WIP] #7106

Closed leecow closed 1 year ago

leecow commented 2 years ago

What's new in .NET 7 Preview 1

This issue is for teams to highlight work for the community that will release .NET 7 Preview 1

To add content, use a new conversation entry. The entry should include the team name and feature title as the first line as shown in the template below.

## Team Name: Feature title

[link to the tracking issue or epic item for the work]

Tell the story of the feature and anything the community should pay particular attention 
to be successful using the feature.

Preview 1: https://github.com/dotnet/core/issues/7106 Preview 2: https://github.com/dotnet/core/issues/7107 Preview 3: https://github.com/dotnet/core/issues/7108 Preview 4: https://github.com/dotnet/core/issues/7378 Preview 5: https://github.com/dotnet/core/issues/7441 Preview 6: https://github.com/dotnet/core/issues/7454 Preview 7: https://github.com/dotnet/core/issues/7455

danmoseley commented 2 years ago

@stephentoub reasonable to blog about regex SG in preview 1? If so, we'll need some content - either from @joperezr or yourself, what do you prefer? It's probably worth its own blog post, but for Preview 1, we'll just need a paragraph/screenshot for the release post.

stephentoub commented 2 years ago

reasonable to blog about regex SG in preview 1?

We can if you think now's a good time.

AaronRobinsonMSFT commented 2 years ago

Now that the DllImport generator is in the product too, perhaps we that also deserves a post or at least a mention? @elinor-fung interested in writing up something? I'd imagine it mentions that is what we did and the plan is to make it available to everyone in the future.

eerhardt commented 2 years ago

.NET Libraries: Nullable annotations for Microsoft.Extensions

https://github.com/dotnet/runtime/issues/43605

We have been making progress on annotating the Microsoft.Extensions.* libraries for nullability. In .NET 7 Preview 1, the following libraries have been annotated for nullability:

You can see the remaining libraries, and follow the progress at https://github.com/dotnet/runtime/issues/43605.

By the time .NET 7 is released, we plan on annotating all the Microsoft.Extensions.* libraries for nullability.

A huge thank you to @maxkoshevoi who has been contributing the bulk of this effort. Without @maxkoshevoi's help, we would not be nearly as far as we are.

tarekgh commented 2 years ago

Observability

Continue improving the tracing APIs:

JulieLeeMSFT commented 2 years ago

CodeGen

Community PRs (Many thanks to JIT community contributors!!)

From @am11

Dynamic PGO

Arm64

Loop Optimizations

General Optimizations

elinor-fung commented 2 years ago

Interop: P/Invoke source generation

https://github.com/dotnet/runtime/issues/60212 https://github.com/dotnet/runtime/issues/60595

We integrated the p/invoke source generator that was prototyped in .NET 6 into dotnet/runtime and have been converting the runtime libraries to use it. This means the converted p/invokes are AOT-compatible and no longer require an IL stub to be generated at runtime.

We intend to make the p/invoke source generator available for use outside the runtime in the future. You can follow our remaining work in https://github.com/dotnet/runtime/issues/60595.

eiriktsarpalis commented 2 years ago

New APIs in System.Text.Json

System.Text.Json ships with a couple of minor quality-of-life enhancements:

lambdageek commented 2 years ago

Mono: Hot Reload

Tracking issue: dotnet/runtime#57365

safern commented 2 years ago

System.Drawing.Common: Unix support dropped

Based on the .NET 6 announcement made in: https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

In addition, we may completely remove support for non-Windows platforms in a future release, even if you enable it using the runtime configuration switch.

We removed support for that switch in 7.0-preview1: https://github.com/dotnet/runtime/pull/64084

mthalman commented 2 years ago

Reverted Console Formatter Change in ASP.NET Core Container Images

In .NET 6, the Logging__Console__FormatterName environment variable was explicitly set to Json in the aspnet container images. Based on usability issues and your feedback, we've reverted this change in .NET 7.

This is a breaking change. If you relied on this environment variable being set to Json for your application, you'll need to explicitly set it yourself in your Dockerfile:

ENV Logging__Console__FormatterName=Json
joperezr commented 2 years ago

Introducing the new Regex Source Generator

https://github.com/dotnet/runtime/issues/44676

Ever wished you had all of the great benefits that come from having a specialized Regex engine that is optimized for your particular pattern, without having to pay the costs of building this engine at runtime? We are excited to announce the new Regex Source Generator which is included in Preview 1. It brings all of the performance benefits from our Compiled engine without the startup cost, and it has additional benefits, like providing a great debugging experience as well as being trimming-friendly. If your pattern is known at compile-time, then the new regex source generator is the way to go.

In order to start using it, you only need to turn the containing type into a partial one, and declare a new partial method with the RegexGenerator attribute that will return the optimized Regex object, and that's it! The source generator will fill the implementation of that method for you, and will get updated automatically as you make changes to your pattern or to the additional options that you pass in. Here is an example:

Before:

public class Foo
{
  public Regex regex = new Regex(@"abc|def", RegexOptions.IgnoreCase);

  public bool Bar(string input)
  {
    bool isMatch = regex.IsMatch(input);
    // ..
  }
}

After:

public partial class Foo  // <-- Make the class a partial class
{
  [RegexGenerator(@"abc|def", RegexOptions.IgnoreCase)] // <-- Add the RegexGenerator attribute and pass in your pattern and options
  public static partial Regex MyRegex(); //  <-- Declare the partial method, which will be implemented by the source generator

  public bool Bar(string input)
  {
    bool isMatch = MyRegex().IsMatch(input); // <-- Use the generated engine by invoking the partial method.
    // ..
  }
}

And that's it. Please try it out and let us know if you have any feedback.

ajhiggins421 commented 2 years ago

System.Drawing.Common: Unix support dropped

Based on the .NET 6 announcement made in: https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

In addition, we may completely remove support for non-Windows platforms in a future release, even if you enable it using the runtime configuration switch.

We removed support for that switch in 7.0-preview1: dotnet/runtime#64084

I am reading this as there is no plans to continue attempts to make forms cross-platform, or anything that relies on system.drawing? What was the point of Microsoft taking over the open-source initiatives to make .NET cross-platform, shut down Net Framework by merging in Core only to decide to drop the cross platform support?

teo-tsirpanis commented 2 years ago

Hello @ajhiggins421, there has never been the plan to make Windows Forms cross-platform; even after it got ported to modern .NET it remains a Windows-only technology. The first link of the post you quoted gives more details about why System.Drawing.Common became Windows-only, and also provides a list of cross-platform alternatives.

If you have any more questions I suggest you reply to dotnet/runtime#64084 or open a new issue on dotnet/runtime instead of replying here; people that might be subscribed to it will get excessive notifications.

danmoseley commented 2 years ago

Correct, Windows Forms and System.Drawing are essentially Windows tech, as they're wrappers over Windows tech. For cross platform UI, you should take a look at MAUI which is being built for that purpose.

KPixel commented 2 years ago

Specifically, Microsoft.Maui.Graphics is the cross-platform graphics library of the future.

ajhiggins421 commented 2 years ago

Sorry for the confusion but AFIAK Microsoft does to support Maui on Linux. See: .NET MAUI Layouts Revamped, Developers Question Lack of Linux. Additionally, It is not removal of System.Drawing that draws my concern but that by removing the library it indicates there are no plans to provide Linux desktop support at all, ever.

After program manager David Ortinau confirmed that "we do not support Linux as a development environment for .NET MAUI," Microsoft exec Richard Lander said, "It would be good knowing how many people would benefit from/need Linux environment support for development."

To which a developer responded: "I do agree. And generally I'm sure that Microsoft will be able to find out the answer in case it feels like it needs to. However since '.NET is Free. Cross platform. Open source' and also 'Supported on Linux, Windows, and macOS' and MAUI is .NET, avoiding Linux support brings some dissonance. I was given tools (C#/F#, .NET), but I can't use them. Not to mention that most popular cross platform UI frameworks do support Linux. So question arises."

I was under the impression the revamping of DotNet under core was to make the framework cross-platform and while specifics on surface areas were not given, I was under the impression except were explicitly stated functionality would be ported. For those not being ported an alternative was being developing, such as WCF and GRPC. I understand Windows.Forms relies on the Internal Windows API. I, and I assume most of the developer community as a whole, was under the impression we would get Linux desktop application at some point. Perhaps, similar to how we were given other Microsoft.* libraries, such as Microsoft.Data.SqlClient.

Again, I have repeatedly read Microsoft does not support Maui on Linux. So is the developer community to take the removal of System.Drawing as confirmation that there are no plans from Microsoft desktop support short of the community providing one. It's not just System.Drawing either. I am seeing other components that gave Linux support, like Mono, being carved out of various libraries moving toward 7. It is almost as if Microsoft is backtracking on its commitment for to Linux support.

danmoseley commented 2 years ago

cc @davidortinau

ThatRendle commented 2 years ago

@ajhiggins421 If you look at the Supported Platforms specifically for Microsoft.Maui.Graphics you'll see that it does support Linux via an abstraction over SkiaSharp. While the complete MAUI platform does not target Linux (yet?), there's no sign of them dropping Linux support from the Graphics component.

I personally would love to see MAUI supporting Linux to compete with, e.g., Flutter, but I understand the importance of prioritizing the other operating systems which have a much larger market share.

hez2010 commented 2 years ago

@ajhiggins421 If you look at the Supported Platforms specifically for Microsoft.Maui.Graphics you'll see that it does support Linux via an abstraction over SkiaSharp. While the complete MAUI platform does not target Linux (yet?), there's no sign of them dropping Linux support from the Graphics component.

I personally would love to see MAUI supporting Linux to compete with, e.g., Flutter, but I understand the importance of prioritizing the other operating systems which have a much larger market share.

Flutter is using Skia to draw controls manually, while MAUI is more about wrapping the platform native controls and abstracting them in a cross-platform way, which can provide much better performance, accessibility and integration, and also enable the ability to draw cross-platform controls using Microsoft.Maui.Graphics. Windows, macOS, Android and iOS, all of them have their own unified native graphic interface and controls, but I don't think Linux has such an interface to provide those controls across all distributions out-of-box. In theory it's possible to build MAUI for Linux on a specific graphics interface provided by the community, such as GTK, but it's not a build-in component in the system so it's hard to be taken as an official solution.

leecow commented 1 year ago

.NET 7 GA is available. Closing these pre-release issues.