Version Used:
Microsoft Visual Studio Enterprise 2017 Preview
Version 15.6.0 Preview 1.0
Steps to Reproduce:
- Load the following code in the editor:
namespace RoslynSandbox
{
public interface IFoo
{
object Bar { get; }
}
class Foo : IFoo
{
public Foo(object bar)
{
this.bar = bar;
}
readonly object bar;
object IFoo.Bar
{
get { return bar; }
}
}
}
- Note that line 15 (
readonly object bar;) is greyed out.
- Click on line 15
- Select the lightbulb
- Select "Use auto properties"
Expected Behavior:
The code fix should either produce workable code, or not be offered.
Actual Behavior:
The resulting code is invalid and does not compile:
namespace RoslynSandbox
{
public interface IFoo
{
object Bar { get; }
}
class Foo : IFoo
{
public Foo(object bar)
{
this.RoslynSandbox.IFoo.Bar = bar;
}
object IFoo.Bar { get; }
}
}
Version Used:
Microsoft Visual Studio Enterprise 2017 Preview
Version 15.6.0 Preview 1.0
Steps to Reproduce:
readonly object bar;) is greyed out.Expected Behavior:
The code fix should either produce workable code, or not be offered.
Actual Behavior:
The resulting code is invalid and does not compile: