On our build server we noticed that one of our builds failed with the following error message:
Error CS1525: Invalid expression term 'throw'
When building the project locally in Visual Studio, we had no errors ?
We found a solution here that worked for us as well:
Update Microsoft.Net.Compilers to 2.0.1 or greater.
We did an Update-All of the NuGet package at the solution level after which the error disappeared…