VB -> C#: Base constructor calls with noncanonical casing produce invalid C#
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先定位转换器识别 VB.NET 基类构造函数初始值设定项的位置;issue 指出它目前依赖区分大小写的文本比较。为大小写混合的 MyBase.new(value) 和无参数形式 MyBase.new 添加回归测试。完成标准是两者都会生成 C# 构造函数初始值设定项,而不是 base.ctor 调用。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C#
- 星标
- 917
- 派生
- 243
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
icsharpcode/CodeConverter 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
icsharpcode/CodeConverter#1271 · 1 条评论 ·
维护者通常 3 天内回复
-
VB -> C#: Generic extension method inference widens element types when using a base-type comparer未关闭VB -> C#
难度 4/5 3-5 天 新手友好度 55/100
icsharpcode/CodeConverter#1302 ·
维护者通常 3 天内回复
-
VB -> C#
难度 3/5 1-2 天 新手友好度 68/100
icsharpcode/CodeConverter#1300 ·
维护者通常 3 天内回复
-
VB -> C#
难度 3/5 1-2 天 新手友好度 62/100
icsharpcode/CodeConverter#1299 ·
维护者通常 3 天内回复
-
VB -> C#
难度 3/5 1-2 天 新手友好度 62/100
icsharpcode/CodeConverter#1298 ·
维护者通常 3 天内回复
查看 icsharpcode/CodeConverter 的全部 Issue
相似的 Issue
-
.NET good first issue testing
难度 2/5 1-3 小时 新手友好度 76/100
HelloblueAI/HelloblueGK#311 ·
维护者通常 1 天内回复
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 2 天内回复
-
State: Needs Discussion
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-dotnet#5876 · 1 条评论 ·
维护者通常 1 天内回复
-
area-Extensions-FileSystem untriaged
难度 2/5 1-3 小时 新手友好度 78/100
dotnet/runtime#136989 · 1 条评论 ·
维护者通常 1 天内回复
-
library-request
难度 2/5 1-3 小时 新手友好度 76/100
QuantConnect/Lean#10034 ·
维护者通常 1 天内回复