dotnet / core

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

What's new in .NET 6 RC1 [WIP] #6569

Closed leecow closed 2 years ago

leecow commented 3 years ago

What's new in .NET 6 RC1

This issue is for teams to highlight work for the community that will release .NET 6 RC1

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/5853 Preview 2: https://github.com/dotnet/core/issues/5889 Preview 3: https://github.com/dotnet/core/issues/5890 Preview 4: https://github.com/dotnet/core/issues/6098 Preview 5: https://github.com/dotnet/core/issues/6099 Preview 6: https://github.com/dotnet/core/issues/6325 Preview 7: https://github.com/dotnet/core/issues/6444

Sergio0694 commented 3 years ago

DependentHandle is now public with streamlined APIs

Sharing this here as suggested by @GrabYourPitchforks, as it was missed in the previous posts for .NET 6 Preview 7. The DependentHandle type is public in .NET 6 (as per https://github.com/dotnet/runtime/pull/54246), with the following API surface:

namespace System.Runtime
{
    public struct DependentHandle : IDisposable
    {
        public DependentHandle(object? target, object? dependent);
        public bool IsAllocated { get; }
        public object? Target { get; set; }
        public object? Dependent { get; set; }
        public (object? Target, object? Dependent) TargetAndDependent { get; }
        public void Dispose();
    }
}

It can be used by (advanced) developers to eg. implement custom caching systems, as well as customized versions of the ConditionalWeakTable<TKey, TValue> type. For instance, it will be used by the WeakReferenceMessenger type in the MVVM Toolkit to avoid memory allocations when broadcasting messages (due to no CWT<K, V>.Enumerator allocations necessary) 🚀

teo-tsirpanis commented 3 years ago

HMAC one-shot methods (dotnet/runtime#40012)

Like the previous entry, this was missed for .NET 6 Preview 6.

The System.Security.Cryptography HMAC classes got some static methods that allow one-shot calculation of HMACs without allocations, similar to the one-shot methods of hashes that were added in a previous release.

namespace System.Security.Cryptography {
    public partial class HMACMD5 {
        public static byte[] HashData(byte[] key, byte[] source) => throw null;
        public static byte[] HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source) => throw null;
        public static int HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination) => throw null;
        public static bool TryHashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten) => throw null;
    }

    public partial class HMACSHA1 {
        public static byte[] HashData(byte[] key, byte[] source) => throw null;
        public static byte[] HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source) => throw null;
        public static int HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination) => throw null;
        public static bool TryHashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten) => throw null;
    }

    public partial class HMACSHA256 {
        public static byte[] HashData(byte[] key, byte[] source) => throw null;
        public static byte[] HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source) => throw null;
        public static int HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination) => throw null;
        public static bool TryHashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten) => throw null;
    }

    public partial class HMACSHA384 {
        public static byte[] HashData(byte[] key, byte[] source) => throw null;
        public static byte[] HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source) => throw null;
        public static int HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination) => throw null;
        public static bool TryHashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten) => throw null;
    }

    public partial class HMACSHA512 {
        public static byte[] HashData(byte[] key, byte[] source) => throw null;
        public static byte[] HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source) => throw null;
        public static int HashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination) => throw null;
        public static bool TryHashData(ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten) => throw null;
    }
}
kouvel commented 3 years ago

.NET 6 compatibility with Intel CET shadow stacks (early preview on Windows)

.NET 6 compatibility with Intel CET shadow stacks is available to try as an early preview from RC1 on Windows for x64 applications. Interested early adopters are encouraged to try it out by opting in at an application level (requires a processor supporting CET and a preview build of Windows), see the link for details.