Skip to content

InternableString.cs fails to compile w/latest roslyn #8014

@MichaelSimons

Description

@MichaelSimons

Source-build is failing to build msbuild with the latest roslyn version.

/repos/tarball-temp/src/msbuild/artifacts/source-build/self/src/src/StringTools/InternableString.cs(173,39): error CS8170: Struct members cannot return 'this' or other instance members by reference [/repos/tarball-temp/src/msbuild/artifacts/source-build/self/src/src/StringTools/StringTools.csproj::TargetFramework=net7.0]
    /repos/tarball-temp/src/msbuild/artifacts/source-build/self/src/src/StringTools/InternableString.cs(173,20): error CS8347: Cannot use a result of 'InternableString.Enumerator.Enumerator(ref InternableString)' in this context because it may expose variables referenced by parameter 'str' outside of their declaration scope [/repos/tarball-temp/src/msbuild/artifacts/source-build/self/src/src/StringTools/StringTools.csproj::TargetFramework=net7.0]

This was caught and discussed in dotnet/installer#14616 (comment).

internal Enumerator(ref InternableString str)

Needs to be

internal Enumerator(scoped ref InternableString str)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triageHave yet to determine what bucket this goes in.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions