Skip to content

Commit 0e79753

Browse files
Timur KelmanTimur Kelman
authored andcommitted
recognize ref return properties when processing ByRef arguments
1 parent 625b8b1 commit 0e79753

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

CodeConverter/CSharp/ExpressionNodeVisitor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1833,7 +1833,9 @@ private RefConversion NeedsVariableForArgument(VBasic.Syntax.ArgumentSyntax node
18331833
RefConversion GetRefConversion(VBSyntax.ExpressionSyntax expression)
18341834
{
18351835
var symbolInfo = GetSymbolInfoInDocument<ISymbol>(expression);
1836-
if (symbolInfo is IPropertySymbol propertySymbol) {
1836+
if (symbolInfo is IPropertySymbol propertySymbol
1837+
// a property in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references
1838+
&& !propertySymbol.ReturnsByRef && !propertySymbol.ReturnsByRefReadonly) {
18371839
return propertySymbol.IsReadOnly ? RefConversion.PreAssigment : RefConversion.PreAndPostAssignment;
18381840
}
18391841

0 commit comments

Comments
 (0)