VB -> C#: Base constructor calls with noncanonical casing produce invalid C#
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start by locating the converter's recognition of VB.NET base-constructor initializers; the issue says it currently relies on a case-sensitive text comparison. Add regression coverage for mixed-case MyBase.new(value) and the parameterless MyBase.new form. Done means both produce a C# constructor initializer rather than a base.ctor call.
Written by the indexing model from the issue text.
Description
VB.Net input code
Public Class DataSet1
Inherits Global.System.Data.DataSet
Public Sub New(value As String)
MyBase.new(value)
End Sub
End Class
Erroneous output
The base constructor call is emitted as a method call inside the constructor body:
public partial class DataSet1 : System.Data.DataSet
{
public DataSet1(string value)
{
base.ctor(value);
}
}
This produces compiler error CS0117 because DataSet does not contain a definition for ctor.
Expected output
public partial class DataSet1 : System.Data.DataSet
{
public DataSet1(string value) : base(value)
{
}
}
Details
- Product: Visual Studio extension, built locally from master.
- Version: 10.0.1 (local development build).
- Previous working version: No.
VB.NET is case-insensitive, so MyBase.New(value), MyBase.new(value), and MyBase.nEw(value) are equivalent. However, the converter uses a case-sensitive text comparison when recognizing the constructor initializer.
The same issue occurs with parameterless calls written without parentheses, such as MyBase.new.
A workaround is to use the canonical casing, MyBase.New.
- Dominant language
- C#
- Stars
- 916
- Forks
- 242
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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 ·
Maintainers usually reply within 3 days
-
VB -> C#: Generic extension method inference widens element types when using a base-type comparerOpenVB -> C#
Difficulty 4/5 3-5 days Newbie friendliness 55/100
icsharpcode/CodeConverter#1302 ·
Maintainers usually reply within 3 days
-
VB -> C#
Difficulty 3/5 1-2 days Newbie friendliness 68/100
icsharpcode/CodeConverter#1300 ·
Maintainers usually reply within 3 days
-
VB -> C#
Difficulty 3/5 1-2 days Newbie friendliness 62/100
icsharpcode/CodeConverter#1299 ·
Maintainers usually reply within 3 days
-
VB -> C#
Difficulty 3/5 1-2 days Newbie friendliness 62/100
icsharpcode/CodeConverter#1298 ·
Maintainers usually reply within 3 days
All issues in icsharpcode/CodeConverter
Similar issues
-
area/resource-registry status/triage
Difficulty 1/5 1-3 hours Newbie friendliness 76/100
Altinn/altinn-auth#4821 ·
Maintainers usually reply within 1 day
-
a11y community:contribution
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
microsoft/fluentui-blazor#5590 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
JetBrains/resharper-unity#2510 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
QuantConnect/Documentation#2838 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
AvaloniaUI/Avalonia#22697 · 1 comment ·
Maintainers usually reply within 1 day