VB -> C# : redim preserve bad choice for temporary var name #393
Labels
compilation error
A bug where the converted output won't compile
good first issue
VB -> C#
Specific to VB -> C# conversion
THANK YOU for your tool.
I think there's a problem with the name of temporary array in the case of redim preserve.
It's called old%FULL_ARRAY_NAME% which breaks if the array is a property of an object instance (among multiple other possible cases)
instead of
var oldinstance.prop = instance.prop is wrong.
it should be
var oldprop = instance.prop
or something like
var __oldinstance__prop = instance.prop
Input code
ReDim Preserve instance.prop(size)
Erroneous output
var oldinstance.prop = instance.prop;
instance.prop = new string[size + 1 + 1];
if (oldinstance.prop != null)
Array.Copy(oldinstance.prop, instance.prop, Math.Min(size + 1 + 1, oldinstance.prop.Length));
Expected output
var oldinstance_prop = instance.prop;
instance.prop = new string[size + 1 + 1];
if (oldinstance_prop != null)
Array.Copy(oldinstance_prop, instance.prop, Math.Min(size + 1 + 1, oldinstance_prop.Length));
Details
VS extension
The text was updated successfully, but these errors were encountered: