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#: NullReferenceException when using the VS extension with .NET Standard #398

Closed
Keex0r opened this issue Oct 24, 2019 · 1 comment · Fixed by #406
Closed

VB -> C#: NullReferenceException when using the VS extension with .NET Standard #398

Keex0r opened this issue Oct 24, 2019 · 1 comment · Fixed by #406
Labels
exception caught An exception is caught (and stacktrace provided) help wanted VB -> C# Specific to VB -> C# conversion

Comments

@Keex0r
Copy link

Keex0r commented Oct 24, 2019

Hello,
I am trying to convert some VB.NET code to C# using the Visual Studio extension in VS2019.
When I try to convert a file containing the input code below, an error message is shown:

CodeConvertError

No output file is generated. The same happens with other source files in the project as well, so it is probably no quirk of the code itself.

The solution contains both .NET Standard and .NET Framework projects, and weirdly this only occurs in .NET Standard (2.0) VB.NET projects. In .NET Framework both VB->C# and C#->VB works, in .NET Standard only C#->VB works.

I have no real clue why. I installed the extension by downloading the installer from the marketplace, instead of installing from the extension manager.
By virtue of the nice async/await stack traces I wasn't really able to find the code where it occurs :-)

Thanks for the work you put in!
Cheers
Jens

Input code

Namespace CAD
    ''' <summary>
    ''' Represents a CAD RGB Color tuple
    ''' </summary>
    Public Structure CADColor
        Public Sub New(A As Byte, R As Byte, G As Byte, B As Byte)
            Me.A = A
            Me.R = R
            Me.G = G
            Me.B = B
        End Sub
        Public Sub New(R As Byte, G As Byte, B As Byte)
            Me.A = 255
            Me.R = R
            Me.G = G
            Me.B = B
        End Sub
        Public Property A As Byte
        Public Property R As Byte
        Public Property G As Byte
        Public Property B As Byte

        Public Shared Function FromArgb(R As Byte, G As Byte, B As Byte) As CADColor
            Return FromArgb(255, R, G, B)
        End Function
        Public Shared Function FromArgb(A As Byte, R As Byte, G As Byte, B As Byte) As CADColor
            Return New CADColor(A, R, G, B)
        End Function
    End Structure
End Namespace

Details

  • Product in use: VS extension
  • Version in use: 7.2.0.0
  • Did you see it working in a previous version, which? --> Never used the extension before
@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Oct 24, 2019 via email

@GrahamTheCoder GrahamTheCoder added exception caught An exception is caught (and stacktrace provided) VB -> C# Specific to VB -> C# conversion help wanted labels Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exception caught An exception is caught (and stacktrace provided) help wanted VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants