VS2010 Background Compiler cannot handle attribute-based optional parameters - by Schabse S. Laks

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
0
Sign in
to vote
ID 636954 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 1/19/2011 2:30:57 PM
Access Restriction Public

Description

Optional parameters can be defined using the [Optional] and [DefaultParameterValue] attributes.  http://blog.slaks.net/2011/01/optional-parameters-in-c-4.html

However, if you call a method with such a parameter in the same project, and omit the parameter, the IDE will report a syntax error.

The code will compile fine, and the syntax error vanishes when you build the project.

Since this is the only way to define optional parameters using CodeDOM, this bug is more serious than it appears at first glance.
Sign in to post a comment.
Posted by Microsoft on 4/4/2011 at 1:57 PM
Thanks for reporting this issue you've encountered with Visual Studio!

This is a known limitation of C#'s IDE compiler. We've explored cleaning this up, but unfortunately, we won't be able to fix this bug in the next version of Visual Studio.

Alex Turner
Program Manager
Visual Basic and C# Compiler
Posted by Microsoft on 1/19/2011 at 4:59 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)