9

What's new in .NET 7 Preview 1 [WIP] · Issue #7106 · dotnet/core · GitHub

 2 years ago
source link: https://github.com/dotnet/core/issues/7106
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Member

leecow commented on Jan 11

edited

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: #7106
Preview 2: #7107
Preview 3: #7108

Copy link

Member

danmoseley commented on Jan 20

@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.

Copy link

Member

stephentoub commented on Jan 20

reasonable to blog about regex SG in preview 1?

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

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.

Copy link

Member

eerhardt commented on Jan 24

.NET Libraries: Nullable annotations for Microsoft.Extensions

dotnet/runtime#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:

  • Microsoft.Extensions.DependencyInjection.Abstractions
  • Microsoft.Extensions.Logging.Abstractions
  • Microsoft.Extensions.Primitives
  • Microsoft.Extensions.FileSystemGlobbing
  • Microsoft.Extensions.DependencyModel
  • Microsoft.Extensions.Configuration.Abstractions
  • Microsoft.Extensions.FileProviders.Abstractions
  • Microsoft.Extensions.FileProviders.Physical
  • Microsoft.Extensions.Configuration
  • Microsoft.Extensions.Configuration.Binder
  • Microsoft.Extensions.Configuration.CommandLine
  • Microsoft.Extensions.Configuration.EnvironmentVariables
  • Microsoft.Extensions.Configuration.FileExtensions
  • Microsoft.Extensions.Configuration.Ini
  • Microsoft.Extensions.Configuration.Json

You can see the remaining libraries, and follow the progress at dotnet/runtime#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.

Copy link

Member

tarekgh commented on Jan 24

Observability

Continue improving the tracing APIs:

  • Adding the overload to ActivityContext.TryParse allows parsing and creating an ActivityContext object including if the activity context was propagated from a remote parent. dotnet/runtime#42575
  • Adding the method Activity.IsStopped() to indicates whether the Activity object is stopped. dotnet/runtime#63353

Copy link

Member

elinor-fung commented on Jan 26

Interop: P/Invoke source generation

dotnet/runtime#60212
dotnet/runtime#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 dotnet/runtime#60595.

Copy link

Member

eiriktsarpalis commented 28 days ago

edited

New APIs in System.Text.Json

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

  • dotnet/runtime#61434: developers now have access to the default JsonSerializerOptions singleton used internally by System.Text.Json.
  • dotnet/runtime#61608: add a JsonWriterOptions.MaxDepth property and ensure this value flows from the equivalent JsonSerializerOptions.MaxDepth property on serialization.
  • dotnet/runtime#60531 Add Patch methods to System.Net.Http.Json.

Copy link

Member

lambdageek commented 27 days ago

edited

Mono: Hot Reload

Tracking issue: dotnet/runtime#57365

  • dotnet/runtime#63513 The following edits are now allowed in C# hot reload for Blazor WebAssembly and .NET for iOS and Android:
    • Adding static lambdas to existing methods
    • Adding lambdas that capture this to existing methods that already have at least one lambda that captures this
    • Adding new static or non-virtual instance methods to existing classes
    • Adding new static fields to existing classes
    • Adding new classes
    • Known issues:
      • instance fields in newly added classes are not supported
      • newly added methods and fields in existing or new classes are not visible to reflection

Copy link

Member

safern commented 24 days 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

Copy link

Member

mthalman commented 16 days 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

Copy link

Member

joperezr commented 13 days ago

Introducing the new Regex Source Generator

dotnet/runtime#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.

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?

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.

Copy link

Member

danmoseley commented 9 days 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.

Copy link

KPixel commented 9 days ago

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

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.

Copy link

markrendle commented yesterday

edited

@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.

Copy link

hez2010 commented yesterday

edited

@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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK