Skip to content

VB -> C#: GetType(Nullable(Of)) is not handled correctly #1165

@jswolf19

Description

@jswolf19

VB.Net input code

Public Class Test
    Public Function IsNullable(ByVal type As Type) As Boolean
        Return type.IsGenericType AndAlso type.GetGenericTypeDefinition() Is GetType(Nullable(Of))
    End Function
End Class

Erroneous output

public class Test {
    public bool IsNullable(Type @type) {
        return type.IsGenericType && ReferenceEquals(type.GetGenericTypeDefinition(), typeof(object));
    }
}

Expected output

public class Test {
    public bool IsNullable(Type @type) {
        return type.IsGenericType && ReferenceEquals(type.GetGenericTypeDefinition(), typeof(Nullable<>));
    }
}

Details

  • Product in use: VS extension
  • Version in use: 9.2.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    VB -> C#Specific to VB -> C# conversion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions