First, some VB keywords are enclosed in brackets in the exported files, for example Using in using clause and Of in generic parameters clause. These keywords are shown correctly in Reflector itself.
Second, the following C# code is disassembled incorrectly:
    rectangle = new Rectangle(0, 0, width, height) {
        X = rectangle.X + (base.Padding.Left - num4),
        Y = rectangle.Y + (base.Padding.Top - num4)
    };
With 3.5 target it gets disassembled to VB.NET as
    rectangle = New Rectangle(0, 0, width, height) { _
        .X = (rectangle.X + (MyBase.Padding.Left - num4)), _
        .Y = (rectangle.Y + (MyBase.Padding.Top - num4)) _
    }
wRAR
0

Comments

2 comments

  • wRAR
    More bad cases.

    3.
        int num;
        for (num = 0; num < 1; num++)
        {
        }
        for (num = 0; num < 1; num++)
        {
        }
    
    converted to
        Dim num As Integer
        num
        For num = 0 To 1 - 1
        Next num
        num
        For num = 0 To 1 - 1
        Next num
    


    4. All C# event declarations (.event/.addon/.removeon) are shown in VB.NET as Custom Event, but without AddHandler/RemoveHandler. The handlers themselves, get_OnFoo/set_OnFoo, can be viewed as ordinary class methods in Reflector and are not emitted on export. The exported code can apparently be fixed by just removing Custom keyword.

    5. Foo(i++) in C# gets translated to VB.NET just as Foo(i++), but VB.NET doesn't have this syntax.

    6.
    (value != this.m_colors[this.m_selindex])) ' operands are Color
    
    was translated to
    (Not value Is Me.m_colors.Item(Me.m_selindex))) 
    
    (and Is is not applicable to Color), though I can't write a trivial testcase. IL has "call bool [System.Drawing]System.Drawing.Color::op_Equality".

    7.
    Module module = Assembly.GetExecutingAssembly().GetModules()[0];
    
    converted to
    Dim module As Module = Assembly.GetExecutingAssembly.GetModules(0)
    

    Two errors here: "Module" should be escaped and GetModules(0) should be GetModules()(0).
    wRAR
    0
  • Clive Tong
    Thanks for reporting these issues - I've logged them as RP-731.
    Clive Tong
    0

Add comment

Please sign in to leave a comment.