All notable changes to PolyKit will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- The polyfill for
System.HashCodehas been removed in favor of the official polyfill: theMicrosoft.Bcl.HashCodepackage. Projects that needSystem.HashCodeshall depend ofMicrosoft.Bcl.HashCode. - Since the polyfill for
System.Rangedepends onSystem.HashCode, it will be included byPolyKit.Embeddedonly if the target platform providesSystem.HashCodenatively (but then it would also provideSystem.Range) or the project has a dependency onMicrosoft.Bcl.HashCode.
- When using
PolyKit.Embeddedin a static analyzer project, Roslyn analyzers would raise error RS1035 ("The symbol 'Random' is banned for use by analyzers: Analyzers must be deterministic"). This was caused by the polyfill forSystem.HashCodeusingSystem.Random(in a way that would not compromise the determinism of the project's analyzers, by the way). This annoyance has been removed as a side effect of the removal of the "offending" polyfill.
3.0.9 (2023-11-26)
This release updates some dependencies to their post-.NET 8.0 versions. No other modifications were made.
3.0.4 (2023-11-20)
- .NET 8 was added as a target platform.
- All polyfills were updated with modifications (if any) made to BCL types up to the release of .NET 8.0.0.
- The polyfill for
ExperimentalAttributehas been added; however, this attribute is only polyfilled by PolyKit.Embedded when compiling with .NET SDK 8.0. This avoids giving the user the false impression that the attribute is supported, when the compiler doesn't actually support it. DateOnlyandTimeOnlypolyfills now supportdeconstruction.
- BREAKING CHANGE: Extension classes that were previously in
PolyKit.*namespaces have been moved toSystem.*namespaces, in order for their members to be more easily discoverable (e.g. by Intellisense) and usable without additionalusingstatements.
This change may seem to go against best practices, as it places PolyKit types in namespaces usually reserved for the BCL; however, it makes sense if you consider that one of the purposes of polyfills is to minimize the amount of code changes necessary to backport code.
Affected extension classes include:PolyKitEnumerable, moved fromPolyKit.LinqtoSystem.Linq;PolyKitExceptionExtensions, moved fromPolyKit.DiagnosticstoSystem;PolyKitStackTraceExtensions, moved fromPolyKit.DiagnosticstoSystem.Diagnostics.
2.0.30 (2022-11-24)
- The polyfill for
DateOnlycould generate aCS8602warning (possible dereference of a null reference). - The polyfill for
TimeOnly, when compiled without span support, generated twoCS1503errors because of a missing preprocessor conditional.
2.0.26 (2022-11-24)
- The polyfills for
DateOnlyandTimeOnlyonly worked when either the target platform supported spans, or theSystem.Memorypackage was referenced.
2.0.24 (2022-11-23)
- .NET 7 was added as a target platform.
- Features that were introduced with .NET 7 are not polyfilled by PolyKit.Embedded when compiling with .NET SDK 6.0. This avoids giving the user the false impression that, for example,
UnscopedRefAttributeis supported, when the compiler doesn't actually support it. - PolyKit now provides a quasi-polyfill for
Enumerable.TryGetNonEnumeratedCount<TSource>. Since extending theEnumerableclass is not possible, PolyKit adds (in thePolyKit.Linqnamespace) aTryGetCountWithoutEnumerating<TSource>extension method that callsTryGetNonEnumeratedCount<TSource>on .NET6.0+ and polyfills as much functionality as possible on older frameworks. - Polyfills for the following features were added:
- required members;
scopedmodifier (including theUnscopedRefattribute);AsyncMethodBuilderattribute;ModuleInitializerattribute;- trimming incompatibility attributes;
UnconditionalSuppressMessageattribute;CompilerFeatureRequiredattribute;RequiresPreviewFeaturesattribute;UnmanagedCallersOnlyattribute;ConstantExpectedattribute;StringSyntaxattribute;ISpanFormattableinterface (note that the polyfill does NOT addISpanFormattablesupport to .NET Runtime types);DateOnlyandTimeOnlystructs (not that the polyfills do NOT implementIParsableandISpanParsable<TSelf>, although the methods are there and can be used as public methods of the individual types).
- BREAKING CHANGE: Following .NET's Library support for older frameworks policy, support for .NET Core 3.1 has been removed.
- All types provideed by PolyKit are now flagged with the necessary attributes to be ignored by code analyzers, debuggers, code coverage tools, code metrics, etc. See this blog post for more information about the attributes added to types and the rationale behind each of them.
1.0.16 (2022-11-01)
Initial release.