ExpressionHelper contains a compatibility bug with Roslyn compiler · Issue #117 · aspnet/AspNetWebStack (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@doggy8088

Description

@doggy8088

There is a bug in the ASP.NET MVC 5.2.3 for a long time. It's hard to explain this in English. So I made a few steps to reproduce this problem.

STEPS TO REPRODUCE THE PROBLEM

  1. Create a simple ASP.NET MVC 5 project using Visual Studio 2017
  2. Apply change to the follow code snippets. Only 3 files to change.
    https://gist.github.com/doggy8088/58dd3c773ef9877155b19ebb2fda8525
  3. Start debugging and navigate to /Home/Index page. Then you will see the result like below:
    image
    As you can see, the @Html.TextBoxFor(m => data[i].Name) generated field name in the for-loop in the view are all wrong.

MORE INFO

This problem is only exists when ASP.NET MVC 5 project using Roslyn to compiler views.

I was wrote an article about 2 years ago. My article is written in Chinse. If some of you can read Chinese, you can also reference my article over here: https://blog.miniasp.com/post/2016/03/06/ASPNET-MVC-5-View-Roslyn-problem-workaround.aspx

I actually proposed a pull request to fix this problem about 2 years ago too. You may check it out too.