-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What's new in .NET 7 Preview 2 [WIP] #7107
Comments
Note: This feature has been present since Preview 1 but didn't make it to the Preview 1 blog post, so copying the content here again in order to get it into Preview 2 blog. Introducing the new Regex Source GeneratorEver 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 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. |
Observabilitystatic Meter s_meter = new Meter("MyLibrary.Queues", "1.0.0");
static UpDownCounter<int> s_queueSize = s_meter.CreateUpDownCounter<int>("Queue-Size");
static ObservableUpDownCounter<int> s_pullQueueSize = s_meter.CreateObservableUpDownCounter<int>("Queue-Size", () => s_pullQueueSize);
...
s_queueSize.Add(10);
s_queueSize.Add(-2); |
The PR for blog post; will remain open until Monday 3/14 noon (PST) The plan is to work on the content in the PR until noon (PST) on Monday 3/14. After that the content will be copied over to the blog and we can make any last minute changes if needed there. |
SDK Improvements
|
Added it to the draft of the blog post |
Added it to the draft of the blog post |
Added it to the draft of the blog post |
Added it to the draft of the blog post |
Added it to the draft of the blog post |
NativeAOT UpdateWe previously announced that we're moving the NativeAOT project out of experimental status and into mainline development in .NET 7. Over the past few months we've been heads down doing the coding to move NativeAOT out of the experimental dotnet/runtimelab repo and into the dotnet/runtime repo. That work has now been completed, but we have yet to add first-class support in the dotnet SDK for publishing projects with NativeAOT. We hope to have that work done shortly, so you can try out NativeAOT with your apps. In the meantime, please try trimming your app and ensure there are no trim warnings. Trimming is a requirement of NativeAOT. If you own any libraries there are also instructions for preparing libraries for trimming. |
Adding NativeAOT update now... |
.NET 7 GA is available. Closing these pre-release issues. |
What's new in .NET 7 Preview 2
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.
Preview 1: #7106
Preview 2: #7107
Preview 3: #7108
Preview 4: #7378
Preview 5: #7441
Preview 6: #7454
Preview 7: #7455
The text was updated successfully, but these errors were encountered: