Skip to content

[Bug] CS8256 triggered for CSPROJ targetting .NET 10 #10901

@smaillet

Description

@smaillet

Describe the bug
'error CS8652: The feature 'field keyword' is currently in Preview and unsupported. To use Preview features, use the 'preview' language version.'

Is triggered during metadata generation for any use of the "field" keyword even though the CSPROJ file targets the .NET 10 framework or has <LangVersion>14</LangVersion>

To Reproduce
Steps to reproduce the behavior:

  1. Add <LangVersion>14</LangVersion> to the CSPROJ
  2. Add a valid use of the new C# 14 'field' keyword
    Example:
private int SomeProperty
{
    get
    {
        ObjectDisposedException.ThrowIf( value < 0, this );
        return field;
    }

    set;
}

Expected behavior
Docs are generated without errors

Context (please complete the following information):

  • OS: Windows 11 25H2
  • Docfx version: 2.78.4+ba9dfcbb96a4ceed2ac6d3ba93e12e16550b3e2a

Additional context
Occurs even if Global.json is set to use .NET 10

{
    "sdk": {
        "version": "10.0.100",
        "rollForward": "latestMinor",
        "allowPrerelease": false
    }
}

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