Wednesday, July 8, 2009

Visual Studio 2008 var Keyword ‘Bug’ – Microsoft Follow-up

I got a response back from Microsoft support regarding an issue with the var keyword in Visual Studio 2008 and what they had to say isn’t particularly surprising (or motivating):

Thanks for the feedback! You're seeing that using C# 3.0 specific language features in a .NET 2.0 targeted web project fails since the code is actually being compiled on the server using the C# 2.0 compiler (more specifically, the script blocks of Web App Projects and all of Web Sites). This is a limitation that we're currently aware of and one that we will be re-evaluating as we begin planning for the next release. In the meantime, when targeting .NET 2.0, you can actually go into "Project | Properties | Build | Advanced Build Settings" and set the language version of the project to be ISO-2, which will force the design time compilers to emit errors for C# 3.0 specific language features.

Given that we won't be able to address this issue in the upcoming VS2010 release, I'm going to go ahead and mark this bug as a "Wont Fix" but please be assured that we are tracking this suggestion internally and will be considering it again for the next product cycle.

Thanks!
DJ Park
C# IDE, Program Manager

I tested the ISO suggestion the report handler sent me and as far as I could tell ISO-2 does not cause Visual Studio to emit any errors when the var keyword is used. ISO-1 did produce some non-standard build errors, but nothing to do with the var keyword. If anyone can demonstrate otherwise I’d love to hear about it in the comments.

It would have been foolish to think Microsoft would actually want to fix this little issue, but at least they know it’s there.

No comments: