Generic type constraint on PatternContext<T>

As part of annotating the .NET library for nullable reference types, a new generic constraint was added to PatternContext<TFrame>. If you're consuming this class directly, your code may break if the TFrame type is not a struct.

Previous behavior

Previously, PatternContext<TFrame> allowed any type to fill the TFrame type parameter.

New behavior

Starting in .NET 7, the generic type parameter on PatternContext<TFrame>, TFrame, is constrained to be a struct.

Version introduced

.NET 7

Type of breaking change

This change can affect source compatibility and binary compatibility.

Reason for change

This change was necessary to annotate the type correctly for nullable contexts.

If you're currently using this type in your code, we recommend that you remove it. This type supports infrastructure and is not intended to be used directly from your code.

Affected APIs