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#: supporting variable for WithEvents gets non-existent type in some cases #1055

Open
TymurGubayev opened this issue Dec 5, 2023 · 0 comments
Labels
compilation error A bug where the converted output won't compile VB -> C# Specific to VB -> C# conversion

Comments

@TymurGubayev
Copy link
Contributor

This happens when the names of a class and its namespace only differ in case (NS1 vs Ns1).

VB.Net input code

Imports NS1

Public Class TestNameSpaceSameNameAsClass
    Public WithEvents ins As NS1.Ns1
End Class

Namespace Global.NS1
    Public Class Ns1
    End Class
End Namespace

Erroneous output

using System.Runtime.CompilerServices;

namespace NS1
{
    public class NS1
    {
    }
}

public class TestNameSpaceSameNameAsClass
{
    private NS1 _ins; //error: this class doesn't exist

    public virtual NS1 ins
    {
        [MethodImpl(MethodImplOptions.Synchronized)]
        get
        {
            return _ins;
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        set
        {
            _ins = value;
        }
    }
}

Expected output

using System.Runtime.CompilerServices;

namespace NS1
{
    public class NS1
    {
    }
}

public class TestNameSpaceSameNameAsClass
{
    private NS1.Ns1 _ins;

    public virtual NS1.Ns1 ins
    {
        [MethodImpl(MethodImplOptions.Synchronized)]
        get
        {
            return _ins;
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        set
        {
            _ins = value;
        }
    }
}

Details

  • Product in use: VS extension
  • Version in use: ae25cdc
  • Did you see it working in a previous version, which? No
  • Any other relevant information to the issue, or your interest in contributing a fix.
@TymurGubayev TymurGubayev added the VB -> C# Specific to VB -> C# conversion label Dec 5, 2023
@GrahamTheCoder GrahamTheCoder added the compilation error A bug where the converted output won't compile label Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compilation error A bug where the converted output won't compile VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

2 participants