Evaluation of named by-ref arguments in C# - by Louis.fr

Status : 


Sign in
to vote
ID 716017 Comments
Status Active Workarounds
Type Bug Repros 1
Opened 12/30/2011 2:46:22 AM
Access Restriction Public


Passing a field of a struct by ref doesn't work when using named arguments. A copy of the structure is made before the address of the field is taken, the original structure's field is therefore left unchanged.

It looks like it happens only with reference-type fields.
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:24 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Microsoft on 4/12/2013 at 4:13 PM
Hi. We fixed this, thanks for bug report.

Posted by Louis.fr on 1/5/2012 at 3:14 AM
I mistyped my example program. I uploaded a Program.cs which I tested. It shows the issue.
Posted by EricLeong [Feedback Moderator] on 1/1/2012 at 6:33 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 review. We will contact you if we require any additional information.
Posted by Alan Pretre on 12/30/2011 at 3:20 PM
I just reproduced it in 60 sec. on a different computer. Take the WinForm source in the forum link and completely replace the Form1 source with that one. Take cae to match the namespace though. When it is working correctly, there will be no message box and the form will appear. If you execute the #else, it will display a message box saying that the dictionatry is null before the form is displayed. -- Alan
Posted by aljodAv on 12/30/2011 at 2:09 PM
I cannot reproduce the bug, following the *steps-to-reproduce*. Please, upload a full compilable VS solution demonstrating the issue, and don't forget the Foo(...) method.
Posted by Alan Pretre on 12/30/2011 at 7:17 AM
Original source file at http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/6a8b6fbf-43b9-4f19-934b-695053b7d60d/#6a8b6fbf-43b9-4f19-934b-695053b7d60d
Posted by MS-Moderator01 on 12/30/2011 at 3:42 AM
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)