It seems IConversionExpression.Conversion in VB always returns default value.
Foe example, with code below, there should be a numeric conversion.
Class Program
Sub M1()
Dim x = 1.0
M2(x)'BIND:"M2(x)"
End Sub
Sub M2(a As Integer)
End Sub
End Class
IInvocationExpression ( Sub Program.M2(a As System.Int32)) (OperationKind.InvocationExpression, Type: System.Void) (Syntax: 'M2(x)')
Instance Receiver: IInstanceReferenceExpression (InstanceReferenceKind.Implicit) (OperationKind.InstanceReferenceExpression, Type: Program) (Syntax: 'M2')
Arguments(1):
IArgument (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument) (Syntax: 'x')
IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int32) (Syntax: 'x')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: System.Double) (Syntax: 'x')
This probably is the cause:
https://github.com/dotnet/roslyn/blob/3f1185b032aa2b3b75d72c6f16846fcdb0ab96c5/src/Compilers/VisualBasic/Portable/Operations/VisualBasicConversionExpression.vb#L18
The property might be initialized before ConversionInternal is initialized.
I agree with @genlu as I've been caught out by that.
Most helpful comment
This probably is the cause:
https://github.com/dotnet/roslyn/blob/3f1185b032aa2b3b75d72c6f16846fcdb0ab96c5/src/Compilers/VisualBasic/Portable/Operations/VisualBasicConversionExpression.vb#L18
The property might be initialized before
ConversionInternalis initialized.