FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Source generated resolver requires C# 9 · Issue #1925 · MessagePack-CSharp/MessagePack-CSharp · GitHub

Source generated resolver requires C# 9 #1925

Description

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:

  1. 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)
{
    // ...
}
  1. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL