Reputation: 1
I am pretty new to C# and ASP.NET Core, but experienced in VB.NET. I can't figure out the following problem.
This is code I got from my colleague. It ran fine on my PC. After updating my Visual Studio IDE from 16.9 to 17.10, I get all sorts of errors. The code passes inline view data to a partial view.
This is a small part of the view:
<partial name="Productiegegevens_Cel" view-data='@new ViewDataDictionary(ViewData)
{
{ "Spacing", "mb-1" },
{ "Label", "Melk prijs (€/100kg)" },
{ "Naam", "melk_prijs" },
{ "Data", Model.Voerefficientie1.productiegegevens.melk_prijs.ToString("n2") },
{ "Data_alt", Model.Voerefficientie2 != null ? Model.Voerefficientie2.productiegegevens.melk_prijs.ToString("n2") : null },
{ "Append", @Model.Voerefficientie1.productiegegevens.melk_prijs_huidig.ToString("n2") }
}' />
In VS 17.10, I get all kinds of weird errors:
Even weirder still, when is double click the error message, it jumps to the right code and the error in the error window disappears. When I compile the code the error messages reappear and the compiler stops with errors.
When I create a viewdata object and pass it to the partial view it work fine. This would be a work-around except for the fact that my code contains al lot of this peaces of code. Was this code legit to begin with, or was is never meant to run?
I have created a new project, imported the code-files. I saw the same behavior. It is reproducible on both my computers. One running Windows 11 the other running Windows 11.
Can someone shed light on this problem for me? I am in the dark here. Thanks, Erik
Upvotes: 0
Views: 77