Open vsfeedback opened 4 years ago
Still an issue with VS2019 16.8.4 Simple code example - if the suggestion is used the code won't compile when targeting Release
// VS2019 will prompt to use expression body
private static void SampleMethod()
{
#if DEBUG
Console.WriteLine("Invoked SampleMethod!");
#endif
}
@MrFelna would you like to contribute a fix here?
@CyrusNajmabadi - I can have a look, but I have not reviewed the Roslyn code before, nor any compiler code. Do you think this is something someone new to the codebase can work on? Having briefly looked at the Contributing-Code .md
file, I think it can be worked on as a bug fix.
I found this item from the Developer community and wanted to avoid reporting a duplicate issue.
This issue has been moved from a ticket on Developer Community.
VS 2019 suggests turning single-line statements to expression body methods, even if the statement is wrapped in an #if directive. It also does this automatically if I select "For the whole project" on another suggestion (I'm including a picture on what I mean)
Some code you can use to reproduce this:
Original Comments
Visual Studio Feedback System on 2/10/2020, 02:37 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)