I'm trying to use a C# 7 ValueTuple as the model for a partial view. It works fine when I use a 4-tuple:
@model System.ValueTuple<string, string, int, int>
But if I try to use a 5-tuple:
@model System.ValueTuple<string, string, int, int, string>
I get a compilation error:
Compiler Error Message: CS1003: Syntax error, ',' expected
When I look at the generated code under "Temporary ASP.NET Files", I think I see the issue:
public class _Page_Views_Reports_TestResultComparison_cshtml : System.Web.Mvc.WebViewPage<System.ValueTuple<string {
Specifically, the ValueTuple gets cut off (which is why I think the compiler is complaining about a missing ',':
System.Web.Mvc.WebViewPage<System.ValueTuple<string {
Is there a workaround other than creating a separate class? I've tried this using the System.ValueTuple NuGet package under .NET 4.6 as well as switching my project to use .NET 4.7 and I get the same error. I've also set the system.codedom
langversion
to latest
.