File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1836,6 +1836,9 @@ RefConversion GetRefConversion(VBSyntax.ExpressionSyntax expression)
18361836 if ( symbolInfo is IPropertySymbol propertySymbol ) {
18371837 return propertySymbol . IsReadOnly ? RefConversion . PreAssigment : RefConversion . PreAndPostAssignment ;
18381838 }
1839+ else if ( symbolInfo is IFieldSymbol { IsConst : true } or ILocalSymbol { IsConst : true } ) {
1840+ return RefConversion . PreAssigment ;
1841+ }
18391842
18401843 if ( DeclaredInUsing ( symbolInfo ) ) return RefConversion . PreAssigment ;
18411844
Original file line number Diff line number Diff line change @@ -4047,6 +4047,40 @@ public static int StaticTestProperty
40474047 return _StaticTestProperty_sPrevPosition + 1;
40484048 }
40494049 }
4050+ }" ) ;
4051+ }
4052+
4053+ [ Fact ]
4054+ public async Task TestRefConstArgumentAsync ( )
4055+ {
4056+ await TestConversionVisualBasicToCSharpAsync (
4057+ @"Class RefConstArgument
4058+ Const a As String = ""a""
4059+ Sub S()
4060+ Const b As String = ""b""
4061+ MO(a)
4062+ MS(b)
4063+ End Sub
4064+ Sub MO(ByRef s As Object) : End Sub
4065+ Sub MS(ByRef s As String) : End Sub
4066+ End Class" , @"
4067+ internal partial class RefConstArgument
4068+ {
4069+ private const string a = ""a"";
4070+ public void S()
4071+ {
4072+ const string b = ""b"";
4073+ object args = a;
4074+ MO(ref args);
4075+ string args1 = b;
4076+ MS(ref args1);
4077+ }
4078+ public void MO(ref object s)
4079+ {
4080+ }
4081+ public void MS(ref string s)
4082+ {
4083+ }
40504084}" ) ;
40514085 }
40524086}
You can’t perform that action at this time.
0 commit comments