VB -> C#: Handleres of sub properties being untracked
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
Research direction
Reproduce the issue with the supplied VB.NET input using the codeconv CLI and compare the generated C# with the expected output. Trace the converter's handling of VB Handles clauses for nested properties; done means Editor1.Properties.Click is subscribed in InitializeComponent alongside Editor1.Click.
Written by the indexing model from the issue text.
Description
VB.Net input code
Imports System.ComponentModel
Public Class EditorProperties
Public Event Click As EventHandler ' Handles clause for this event is silently dropped
End Class
Public Class Editor
Private ReadOnly _properties As New EditorProperties()
' DesignerSerializationVisibility.Content is what makes this property usable in a Handles clause
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public ReadOnly Property Properties As EditorProperties
Get
Return _properties
End Get
End Property
Public Event Click As EventHandler
End Class
<Microsoft.VisualBasic.CompilerServices.DesignerGenerated>
Partial Public Class Form1
Private Sub InitializeComponent()
Me.Editor1 = New Editor()
End Sub
Friend WithEvents Editor1 As Editor
End Class
Partial Public Class Form1
Private Sub Editor1_Properties_Click(sender As Object, e As EventArgs) Handles Editor1.Properties.Click
End Sub
Private Sub Editor1_Click(sender As Object, e As EventArgs) Handles Editor1.Click
End Sub
End Class
Erroneous output
public partial class Form1
{
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
Editor1 = new Editor();
Editor1.Click += new EventHandler(Editor1_Click);
}
internal Editor Editor1;
}
public partial class Form1
{
private void Editor1_Properties_Click(object sender, EventArgs e) // This handler lost tracker
{
}
private void Editor1_Click(object sender, EventArgs e)
{
}
}
Expected output
public partial class Form1
{
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
Editor1 = new Editor();
Editor1.Click += new EventHandler(Editor1_Click);
Editor1.Properties.Click += new EventHandler(Editor1_Properties_Click); // Expected
}
internal Editor Editor1;
}
Details
- Product in use: codeconv CLI global tool (icsharpcode.codeconverter.codeconv)
- Version in use: 10.0.1.923
- Dominant language
- C#
- Stars
- 913
- Forks
- 244
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from icsharpcode/CodeConverter
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
icsharpcode/CodeConverter#1271 · 1 comment ·
-
C# -> VB
Difficulty 4/5 3-5 days Newbie friendliness 35/100
icsharpcode/CodeConverter#1281 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
icsharpcode/CodeConverter#1275 ·
-
VB -> C#: "Group By Into" Linq queries supressing aggregations ("Into" part) in the converted code OpenDifficult area VB -> C#
Difficulty 3/5 1-2 days Newbie friendliness 74/100
icsharpcode/CodeConverter#1272 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
icsharpcode/CodeConverter#1270 ·
All issues in icsharpcode/CodeConverter
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·