Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when converting multi-function calls to function with ref parameter #876

Closed
blackboxjt opened this issue Apr 13, 2022 · 1 comment
Closed

Comments

@blackboxjt
Copy link

The converter, when attempting to convert code that could hit Visual Studio Compiler Error CS0206 (A property or indexer may not be passed as an out or ref parameter, https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0206), it smartly refactored code, but did not put correct function (bolded) in resultant code.
hs7303856635d84b49b041320d14e11afc() should be localInlineAssignHelper() instead

VB.NET Code block:

  		' Create a new color matrix and set the alpha value to 0.5
  		Dim alphaMatrix As New ColorMatrix()
  		alphaMatrix.Matrix00 = InlineAssignHelper(alphaMatrix.Matrix11, InlineAssignHelper(alphaMatrix.Matrix22, InlineAssignHelper(alphaMatrix.Matrix44, 1)))
  		alphaMatrix.Matrix33 = Me._StyleProvider.Opacity

Converted C# Code block:

            // Create a new color matrix and set the alpha value to 0.5
            var alphaMatrix = new ColorMatrix();
            float localInlineAssignHelper() { float argtarget = alphaMatrix.Matrix44; var ret = InlineAssignHelper(ref argtarget, 1f); alphaMatrix.Matrix44 = argtarget; return ret; }

            float localInlineAssignHelper1() { float argtarget = alphaMatrix.Matrix22; var ret = InlineAssignHelper(ref argtarget, hs7303856635d84b49b041320d14e11afc()); alphaMatrix.Matrix22 = argtarget; return ret; }

            float argtarget = alphaMatrix.Matrix11;
            alphaMatrix.Matrix00 = InlineAssignHelper(ref argtarget, localInlineAssignHelper1());
            alphaMatrix.Matrix11 = argtarget;
            alphaMatrix.Matrix33 = _StyleProvider.Opacity;
@GrahamTheCoder
Copy link
Member

Apologies for not replying here. I didn't have time to construct a self-contained repro at the time and then forgot about it. I've just pushed a fix to master which will be released in the near future. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants