I'm using VS 2017 Enterprise RC4 (26206.0) on Windows 10 (version 1607). The type of project used here is an ASP.NET Core web application targeting .NET Core. Here are the steps to reproduce:
3. Modify the `Controllers\HomeController.cs` file's `Index` action method to resemble the following:
```c#
public IActionResult Index()
{
return View();
}
After saving the changes to the Index action method, a red squiggly line appears under return View();. Hover over this, and click the "Show potential fixes" link. The following error appears:
Here's the stack trace:
System.NullReferenceException : Object reference not set to an instance of an object.
at Microsoft.CodeAnalysis.CSharp.Extensions.ArrowExpressionClauseSyntaxExtensions.ConvertToBlock(ArrowExpressionClauseSyntax arrowExpression,SyntaxToken semicolonToken,Boolean createReturnStatementForExpression)
at Microsoft.CodeAnalysis.CSharp.UseExpressionBody.AbstractUseExpressionBodyCodeFixProvider`1.WithGenerateBody(TDeclaration declaration,OptionSet options)
at Microsoft.CodeAnalysis.CSharp.UseExpressionBody.AbstractUseExpressionBodyCodeFixProvider`1.Update(TDeclaration declaration,Boolean preferExpressionBody,OptionSet options)
at Microsoft.CodeAnalysis.CSharp.UseExpressionBody.AbstractUseExpressionBodyCodeFixProvider`1.AddEdits(SyntaxEditor editor,Diagnostic diagnostic,OptionSet options,Boolean preferExpressionBody,CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.UseExpressionBody.AbstractUseExpressionBodyCodeFixProvider`1.FixAllAsync(Document document,ImmutableArray`1 diagnostics,SyntaxEditor editor,CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CodeFixes.SyntaxEditorBasedCodeFixProvider.<>c__DisplayClass2_0.<FixAllAsync>b__0(SyntaxEditor editor)
at async Microsoft.CodeAnalysis.CodeFixes.SyntaxEditorBasedCodeFixProvider.FixAllWithEditorAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputePreviewOperationsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetPreviewOperationsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.GetPreviewResultAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionWithNestedFlavors.<>c__DisplayClass11_0.<GetPreviewAsync>b__0(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
I'm using VS 2017 Enterprise RC4 (26206.0) on Windows 10 (version 1607). The type of project used here is an ASP.NET Core web application targeting .NET Core. Here are the steps to reproduce:
.editorconfig
file to theSolution Items
solution folder. It should contain the following:[*.cs] csharp_style_expression_bodied_methods = true : error
Index
action method, a red squiggly line appears underreturn View();
. Hover over this, and click the "Show potential fixes" link. The following error appears:Here's the stack trace:
/cc: @morrisjoe