Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jswolf19 opened this issue Jan 9, 2025 · 0 comments
Open

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

jswolf19 opened this issue Jan 9, 2025 · 0 comments
Labels
VB -> C# Specific to VB -> C# conversion

Comments

@jswolf19
Copy link

jswolf19 commented Jan 9, 2025

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
@jswolf19 jswolf19 added the VB -> C# Specific to VB -> C# conversion label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

1 participant