icsharpcode / CodeConverter

Convert code from C# to VB.NET and vice versa using Roslyn
https://icsharpcode.github.io/CodeConverter/
MIT License
830 stars 217 forks source link

When converting a WPF form, the Handles command in the code behind file is skipped. #1141

Open mjohansson1 opened 1 week ago

mjohansson1 commented 1 week ago

VB.Net input code

    Private Sub TextBoxConnectionString_ValueChanged(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles TextBoxTab3Item.TextChanged, TextBoxTab3Detail.TextChanged
        Changes.Tab3 = True
    End Sub

Erroneous output

        private void TextBoxConnectionString_ValueChanged(object sender, System.Windows.RoutedEventArgs e)
        {
            Changes.Tab3 = true;
        }

Expected output

        private void TextBoxConnectionString_ValueChanged(object sender, System.Windows.RoutedEventArgs e)
        {
            Changes.Tab3 = true;
        }
...
Then, elsewhere in the file:
this.TextBoxTab3Item.TextChanged+= FormEditConfig_Closing;

Details

When converting a WPF form, the Handles command in the code behind file is skipped meaning that no events ever fire.

mjohansson1 commented 1 week ago

I checked around and none of the VB->C# converters are doing this. They all just leave it for you to do manually. Manually does not work for me with a million+ lines of code. I just asked ChatGPT to please do this for me and it did. So, workaround is working.