Supported framework #2877
Replies: 7 comments
-
TL;DR: Not really, but depending on what you care about you might be able to use it just fine. Depends on what you mean by "supported". Many of C# 8.0's features rely on support from the framework. Additionally, default interface methods rely on support from the runtime. As per this article (see section "Platform Dependencies), even .NET Framework 4.8 will not receive the necessary updates. In the past Microsoft has maintained NuGet packages to provide backwards compatibility for new language features. I can't find a source, but I recall reading that this will no longer be the case since maintaining these packages was problematic. Additionally, Microsoft is actively discouraging people from using C# versions that aren't blessed for a particular framework version. You can, however, manually set the target language version to C# 8.0. Depending on the feature you're wanting to use, it may or may not work. I've used C# 8.0 with .NET Framework 4.7.2 and at the very least pattern matching and nullable reference types were working (although the framework class libraries were understandably not annotated.) |
Beta Was this translation helpful? Give feedback.
-
The communication around this topic hasn't been great. Officially, C# 8.0 is only supported on runtimes that adhere to the .NET Standard 2.1. That does not (and will not) include .NET Framework 4.x. Many of the language features in C# 8.0 rely on support from the runtime, mostly in the form of new types or attributes which you can technically polyfill yourself or through NuGet packages. Microsoft has communicated that they wouldn't be providing those packages but I expect that others will (or already have, I've not looked). Default interface methods relies on new functionality in the runtime itself that cannot be polyfilled (easily). Because of this it was decided that the experience of trying to use C# 8.0 with older versions of the framework would be a poor experience due to many of the features not working so they tied the tooling to require C# 8.0 to target .NET Core 3.0. However, you can manually edit the project files to change the target and Visual Studio will honor it. |
Beta Was this translation helpful? Give feedback.
-
Just to add, NRTs seem to work fine on older Framework versions, and I believe you can use this tool to annotate the BCL APIs with nullability annotations. |
Beta Was this translation helpful? Give feedback.
-
It should be clearified feature by feature:
|
Beta Was this translation helpful? Give feedback.
-
@patelbinal C# 8.0 is not considered fully supported for .NET Framework, and there are no plans to bring it up to the full level of support that .NET Core 3.0 and .NET Standard 2.1 have. Please see this blog post for more details on why new features aren't fully supported for .NET Framework moving forward: https://devblogs.microsoft.com/dotnet/net-core-is-the-future-of-net/ |
Beta Was this translation helpful? Give feedback.
-
Unmanaged constructed types works. The |
Beta Was this translation helpful? Give feedback.
-
Is there some official documentation (on docs.microsoft.com, not a blog post or GitHub issue) for this? I know about https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version but that only covers the default language version and doesn't mention supported language versions. |
Beta Was this translation helpful? Give feedback.
-
Is C# 8.0 supported in .NET framework 4.7.1?
Beta Was this translation helpful? Give feedback.
All reactions