Skip to content

nameof of Color Color in field initializer results in "Unable to determine specific cause of the failure." #82474

@jjonescz

Description

@jjonescz

Version Used: 5.5.0-2.26110.7 (47f526d)

Steps to Reproduce:

#:property LangVersion=8.0
class C
{
    string f = $"X_{nameof(D.M)}";
    public D D { get; private set; }
}
class D
{
    public void M() { }
}

.NET Lab

Expected Behavior: Fails with error CS8400: Feature 'instance member in 'nameof'' is not available in C# 8.0. Please use language version 12.0 or greater.

Actual Behavior: Fails with error CS7038: Failed to emit module 'TestProject': Unable to determine specific cause of the failure.

Note: Originally reported by a customer internally over e-mail.

This is also a regression (no error is reported by for example Roslyn 5.0.0-2.26075.103 (123b078)), so we need to decide whether the langversion error should be reported or this should successfully compile again.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions