Bug description
Source generated resolver requires C# 9. .netstandard 2.0 project needs to add <LangVersion>9.0</LangVersion> to avoid compilation error. There are two parts of code causing this issue:
- The following code causes "Feature 'target-type object creation' is not available in C# 7.3. Please use language version 9.0 or greater."
private static readonly global::System.Collections.Generic.Dictionary<global::System.Type, int> closedTypeLookup = new(24)
{
// ...
}
- The following code causes "Feature 'recursive patterns' is not available in C# 7.3. Please use language version 8.0 or greater."
return closedKey switch
{
0 => new MsgPack::Formatters.ListFormatter<int>(),
// ...
}
Repro steps
Use MessagePack 3.x in a .netstandard 2.0 project
Expected behavior
.netstandard 2.0 doesn't need to change language version.
Actual behavior
.netstandard 2.0 project needs to add <LangVersion>9.0</LangVersion> to avoid compilation error.
- Version used: 3.0.134-beta
- Runtime: .NET Core
Bug description
Source generated resolver requires C# 9. .netstandard 2.0 project needs to add
<LangVersion>9.0</LangVersion>to avoid compilation error. There are two parts of code causing this issue:Repro steps
Use MessagePack 3.x in a .netstandard 2.0 project
Expected behavior
.netstandard 2.0 doesn't need to change language version.
Actual behavior
.netstandard 2.0 project needs to add
<LangVersion>9.0</LangVersion>to avoid compilation error.