You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Drop support for .NET Framework 4.0 - 4.6 (e.g. require 4.6.1, which supports .NET Standard 2.0) #1299
I propose we drop support for the older .NET Framework versions, that do not support .NET Standard 2.0. According to the official documentation this would leave us with:
.NET Framework 4.6.1+ (requires manual installation on Windows 8.X, Windows 10 1507 (the very first one), and Windows Server 2012 + R2)
.NET Core 2.0+
Mono 5.4+
Xamarin.Mac 3.8+
Unity 2018.1+
This should remove the xplat option, and a few polyfills as well as dependency on Python modules inside C# code in some cases (OS detection).
Dropping the old stuff is fine by me.
Support for OSPlatform (in .NET Framework 4.7.1) would allow removing some
hacky code to find the current platform.
For Unity's needs we only need support for whatever 2019.4 supports.
Unity 2019.4 uses Mono 5.11 with /langversion:latest which per the
documentation for Mono 5.10 should mean 4.7.1 ; it does this both when
claiming to support .NET Standard 2.0 and .NET 4.x
In testing, I can indeed use OSPlatform.X on Unity 2019.4, for X = Windows,
Linux, or OSX -- but not for FreeBSD, which requires 5.0 (Unity doesn't run
on FreeBSD anyway).
@filmor apologies for hijacking an old thread, can create a new issue if you want.
Are there any actual blockers which prevent at least limited support of 4.6.1 as a part of .NET Standard 2.0?
I needed that and while I know that 4.6.1/Standard 2.0 situation is messy in .NET in general, I've:
patched CLR Loader to compile for net461 (LPUTF8Str -> IntPtr with manual conversion, ValueTuple -> Tuple),
referenced ValueTuple and InteropServices in Python.Runtime.csproj,
made a build step to copy netstandard.dll assembly to the OutDir,
and only if I switch the target framework to net461 for Python.Runtime.csproj, then I am able to run a simple hello world successfully from Python in a 4.6.2 environment. If I switch target back to netstandard2.0 -- the assemblies disappear from the output, and even if I add them back - I for some reason get errors on loading them which I currently am not sure how to resolve:
Failed to initialize pythonnet: System.TypeInitializationException: The type initializer for 'Delegates' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at Python.Runtime.Platform.LibraryLoader.get_Instance()
at Python.Runtime.Runtime.Delegates..cctor()
--- End of inner exception stack trace ---
at Python.Runtime.Runtime.Delegates.get_PyGILState_Ensure()
at Python.Runtime.Runtime.PyGILState_Ensure()
at Python.Runtime.Py.GIL()
at Python.Runtime.Loader.Initialize(IntPtr data, Int32 size)
at Python.Runtime.Runtime.Delegates.get_PyGILState_Ensure()
at Python.Runtime.Runtime.PyGILState_Ensure()
at Python.Runtime.Py.GIL()
at Python.Runtime.Loader.Initialize(IntPtr data, Int32 size)
I am not sure how to properly make netstandard2.0 assembly to reference and copy those DLLs properly for running on 4.6.1, would appreciate some insight on what I am doing wrong.
If this is reasonably solvable, will there be opposition to allowing 4.6.1 (with a strong recommendation to update to 4.7.2) potentially, if, say, I submit the PR fitting the requirements?
Also, outside of that, are there any blockers for going even lower theoretically (if I don't need to support anything else than .NET Framework)? Not as a part of the upstream/mainline.
Activity
filmor commentedon Dec 1, 2020
.NET Standard before 4.7.2 has unfixed bugs, so that should be the target.
lostmsu commentedon Dec 1, 2020
Are any of those bugs important for us?
benoithudson commentedon Dec 1, 2020
filmor commentedon Dec 2, 2020
Do you happen to know what the support-level of Unity 2019.4 is? Should be enough to know what Mono version is linked.
benoithudson commentedon Dec 2, 2020
filmor commentedon Dec 10, 2020
With #1209 merged, we now test .NET 4.7.2 and .NET Standard 2.0. .NET Standard 2.0 is the hard requirement.
Metadorius commentedon Mar 6, 2026
@filmor apologies for hijacking an old thread, can create a new issue if you want.
Are there any actual blockers which prevent at least limited support of 4.6.1 as a part of .NET Standard 2.0?
I needed that and while I know that 4.6.1/Standard 2.0 situation is messy in .NET in general, I've:
LPUTF8Str->IntPtrwith manual conversion,ValueTuple->Tuple),Python.Runtime.csproj,netstandard.dllassembly to theOutDir,and only if I switch the target framework to net461 for Python.Runtime.csproj, then I am able to run a simple hello world successfully from Python in a 4.6.2 environment. If I switch target back to
netstandard2.0-- the assemblies disappear from the output, and even if I add them back - I for some reason get errors on loading them which I currently am not sure how to resolve:I am not sure how to properly make
netstandard2.0assembly to reference and copy those DLLs properly for running on 4.6.1, would appreciate some insight on what I am doing wrong.If this is reasonably solvable, will there be opposition to allowing 4.6.1 (with a strong recommendation to update to 4.7.2) potentially, if, say, I submit the PR fitting the requirements?
Also, outside of that, are there any blockers for going even lower theoretically (if I don't need to support anything else than .NET Framework)? Not as a part of the upstream/mainline.