1

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.

Djensen
  • 1,337
  • 1
  • 22
  • 32
  • I have checked `@model System.ValueTuple` in both ASP.NET Core 2.2 and ASP.NET MVC5 with .NET 4.7.2. It happily compiled. – TanvirArjel Feb 08 '19 at 18:35
  • Tried it again with a fresh ASP.NET project in VS 15.9.6. The project compiles fine, but when I go to run it I get an error and the generated code still seems to have the same issue: `public class _Page_Views_Home_Index_cshtml : System.Web.Mvc.WebViewPage – AlexLostDba Feb 08 '19 at 19:52

0 Answers0