Overview
Upgrade all NumSharp projects from netstandard2.0 / netcoreapp2.x / netcoreapp3.0 to net8.0;net10.0 multi-targeting, removing legacy compatibility shims and unlocking modern .NET APIs.
Problem
NumSharp targets end-of-life runtimes:
| Current TFM |
EOL Date |
netstandard2.0 |
Locks out all .NET 6+ APIs |
netcoreapp2.1 |
August 2021 |
netcoreapp3.0 |
March 2020 |
This blocks access to modern capabilities:
| Blocked API |
What it enables |
FrozenDictionary |
Faster type-promotion lookups in hot paths |
NativeMemory.AlignedAlloc |
SIMD-aligned memory allocation (#528) |
NativeMemory.AllocZeroed |
Optimized np.zeros allocation (#528) |
INumber<T> / Generic Math |
Collapse 161 files of 12-way type switches |
Vector128<T> / Vector256<T> |
SIMD-vectorized arithmetic loops |
[SupportedOSPlatform] |
Platform annotations for NumSharp.Bitmap |
The codebase also carries dead weight from the netstandard2.0 era:
[Serializable] / ISerializable (throws PlatformNotSupportedException on .NET 5+)
#if !NETSTANDARD / #if NETSTANDARD2_0 dead preprocessor branches
[DllImport("lapack")] P/Invoke declarations (all wrappers return null/default)
System.Memory and System.Runtime.CompilerServices.Unsafe NuGet deps (built into net8.0+)
Proposal
Target frameworks
| Project |
Current |
Proposed |
| NumSharp.Core |
netstandard2.0 |
net8.0;net10.0 |
| NumSharp.Bitmap |
netstandard2.0 |
net8.0;net10.0 |
| NumSharp.UnitTest |
netcoreapp3.0 |
net8.0;net10.0 |
| NumSharp.Benchmark |
netcoreapp3.0 |
net8.0;net10.0 |
| NumSharp.Examples |
netcoreapp2.1 |
net8.0;net10.0 |
| NumSharp.ConsumePackage |
netcoreapp2.1 |
net8.0;net10.0 |
| NeuralNetwork.NumSharp |
netcoreapp2.1 |
net8.0;net10.0 |
Tasks
Evidence
- net8.0: Current LTS (supported until November 2026). Most production .NET apps target this.
- net10.0: Upcoming LTS. Forward compatibility.
- netstandard2.0 drop: Consumers on older runtimes can pin to the last netstandard2.0 NuGet release. The library was dormant for years; there is no active consumer base depending on new releases for old runtimes.
- Zero external runtime dependencies after upgrade (both NuGet packages are inbox on net8.0+).
Scope / Non-goals
Breaking changes
| Change |
Impact |
Migration |
| Minimum runtime .NET 8.0 |
Drops .NET Framework, .NET Core 2.x/3.x, .NET 5/6/7 |
Pin to last netstandard2.0 NuGet release |
| Binary serialization removed |
[Serializable] / ISerializable gone from exceptions, hash sets, random state |
Use np.save / np.load for NDArray persistence |
| LAPACK P/Invoke removed |
np.LAPACKProvider and related types deleted |
Non-functional (returned null); no working code affected |
Related issues
Overview
Upgrade all NumSharp projects from
netstandard2.0/netcoreapp2.x/netcoreapp3.0tonet8.0;net10.0multi-targeting, removing legacy compatibility shims and unlocking modern .NET APIs.Problem
NumSharp targets end-of-life runtimes:
netstandard2.0netcoreapp2.1netcoreapp3.0This blocks access to modern capabilities:
FrozenDictionaryNativeMemory.AlignedAllocNativeMemory.AllocZeroednp.zerosallocation (#528)INumber<T>/ Generic MathVector128<T>/Vector256<T>[SupportedOSPlatform]The codebase also carries dead weight from the netstandard2.0 era:
[Serializable]/ISerializable(throwsPlatformNotSupportedExceptionon .NET 5+)#if !NETSTANDARD/#if NETSTANDARD2_0dead preprocessor branches[DllImport("lapack")]P/Invoke declarations (all wrappers return null/default)System.MemoryandSystem.Runtime.CompilerServices.UnsafeNuGet deps (built into net8.0+)Proposal
Target frameworks
netstandard2.0net8.0;net10.0netstandard2.0net8.0;net10.0netcoreapp3.0net8.0;net10.0netcoreapp3.0net8.0;net10.0netcoreapp2.1net8.0;net10.0netcoreapp2.1net8.0;net10.0netcoreapp2.1net8.0;net10.0Tasks
.csprojtarget frameworks tonet8.0;net10.0System.MemoryandSystem.Runtime.CompilerServices.UnsafeNuGet deps#if NETSTANDARD2_0build breaks (collapseSteppingExtension.csto single path)[Serializable],ISerializable, serialization constructors,#if !NETSTANDARDdirectives) from 9 filesMarshal.SizeOfpragma innp.save.csFrozenDictionary(3 files)[SupportedOSPlatform("windows")]to NumSharp.Bitmapnet8.0andnet10.0Evidence
Scope / Non-goals
FrozenDictionaryoptimization, platform annotationNativeMemorymigration (Modernize unmanaged allocation: Marshal.AllocHGlobal → NativeMemory #528), Generic Math refactor, SIMD vectorization — these build on top of this upgrade but are tracked separatelyBreaking changes
[Serializable]/ISerializablegone from exceptions, hash sets, random statenp.save/np.loadfor NDArray persistencenp.LAPACKProviderand related types deletedRelated issues