Cannot use ParameterBuilder.SetConstant with an empty Nullable. - by Erzengel des Lichtes

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.


3
0
Sign in
to vote
ID 716160 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 12/31/2011 7:30:10 PM
Access Restriction Public

Description

Nullables are boxed as their inner type. This means that a ParameterBuilder whose type is a Nullable cannot be given a default value of a nullable with HasValue = false, as "Null is not a valid constant value for this type". However, C#'s compiler is capable of doing this with its own functions, only functions generated via Reflection.Emit are unable.
Sign in to post a comment.
Posted by Microsoft on 1/11/2012 at 11:13 AM
Thanks for reporting this issue. This is indeed a bug in Reflection.Emit. "null" should be allowed as a default value of parameters of Nullable types.

Unfortunately, we are not able to provide a fix for this issue in the current version of .Net Framework. We are, however, keeping this bug so that we can consider it in a future version of the .Net Framework.

Thanks again for your feedback.

Weitao Su
Microsoft Corp.
Posted by MS-Moderator08 [Feedback Moderator] on 1/1/2012 at 10:34 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 12/31/2011 at 7:41 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)