ASP.NET Razor Pages Syntax I - Conditionals in Razor Pages - Switch Statements - Error with Test 3

Summary of the report

Final test will never pass if your you have a space after your @switch statement.

I discovered the issue after giving up and viewing the solution. I then ran the solution code and my code through a diff tool. The single space was the only difference that made it pass when I changed my code to match the solution code.

I was able to reset my code and reproduce this more than once to confirm.

The tests fail if your code looks like this:

@switch (grade)

but pass if your code looks like this


The error message presented is not helpful/relevant. Additionally, the formatting in the example portion of the the lesson uses a space here, so the error is counter intuitive. This is a minor error but led to quite a bit of frustration. The single whitespace in question has no syntatic significance whatsoever in C#.

Course URL:

Steps to Reproduce:

  1. Write all the code for the assignment
  2. Have a space between switch and open paren (see above)
  3. Test will never pass, even if code is correct

Fix or Workaround:

Delete the space in your code, if you have one