Visual studio just started throwing “error BC30037: Character is not valid.” at me (while validating a web site) wherever I have use the nullable operator anywhere within one of my VB.NET 3.5 projects. This happened to a colleague some months ago but he doesn’t remember how he fixed it.
For example, if I change every instance of Double? to Nullable(Of Double), it compiles just fine, and other usage of nullables in other projects in the same solution are continuing to work just fine.
I’ve tried cleaning the solution, closing Visual Studio, deleting the Temporary ASP.NET files, and restarting Visual Studio to no avail.
Anything else I could try?
ADDITION:
I thought I would mention that delegate syntax is also failing. I have this piece of code:
Dim hasSkips As Boolean = payments.Where(Function(p) p.Code = "SKIP").Count > 0
Dim isRegular As Boolean = Not hasSkips
payments is an IList(Of Payment). The Payment object has a string property called Code. There are no validation errors or anything visible in Visual Studio that makes it think it doesn’t know what that line of code does. Intellisense works just fine, but the compiler has a fit with the syntax. The following two errors accompany the above two lines of code, respectively:
error BC30201: Expression expected.
error BC30451: Name 'hasSkips' is not declared.
It would almost seem as if Visual Studio has no knowledge of the VB.NET 3.5 features it’s supposed to know about.
I figured it out. The web site project needs to be instructed which version of the compiler to use, even after you choose the version in the property pages. Added this to my web.config fixed the issue:
Well, good to know I guess.