VB -> C#: If interface and class member differ only by capitalization, the class member's case is changed.
まだ誰も着手していません。
評価
調査の方向性
報告された VB 入力を再現し、生成された C# を期待される明示的なインターフェイス実装と比較します。名前が大文字と小文字の違いしかない Implements メンバーをコンバーターがどのように処理するかを追跡し、その後、元のメンバーの大文字と小文字の表記およびインターフェイスのマッピングが保持されることを示すリグレッションテストカバレッジを追加します。
索引モデルが issue の本文から書いたものです。
説明
VB.Net input code
Public Interface I
Public Sub A()
End Interface
Public Class C
Implements I
Public Sub a() Implements I.A
End Sub
End Class
Erroneous output
public partial interface I
{
public void A();
}
public partial class C : I
{
public void A()
{
}
}
Expected output
public partial interface I
{
public void A();
}
public partial class C : I
{
public void a()
{
}
void I.A() => a();
}
OR
public partial interface I
{
public void A();
}
public partial class C : I
{
/* TODO WARNING: Case changed from a to A (to match supertype) */
public void A()
{
}
}
Details
- Product in use: icsharpcode.github.io/CodeConverter
- Version in use: 9.0.4.0
- Why is this a problem?
- VB.NET is case-insensitive, but CIL isn't. Thus, if you convert a library from VB to C# and the capitalization of a public member changes, you break binary-compatibility, i.e., an application compiled to the VB version of your library won't work with the C# version.
- You also break source-compatibility, if your VB library is used by C# applications.
- The converter already produces the expected output (method + second method with explicit interface implementation) if you replace
Public Sub a() Implements I.AbyPublic Sub b() Implements I.A. So the fix might be as easy as changing a case-insensitive comparison to a case-sensitive one. - I admit that
a/Ais a contrived example, but a real-life use case would be an abbreviation that is capitalized differently. In our code base, we stumbled upon this issue withSub AddSubSQL(interface) vsSub AddSubSql(class). - Note that this change will trigger a warning: CS3005 Identifier 'C.a' differing only in case is not CLS-compliant, so it might make sense to additionally add the a
[CLSCompliant(false)]attribute to the method. Unfortunately, I don't know enough about CLS compliance to be able to evaluate the impact of this change.
- 主要言語
- C#
- スター
- 913
- フォーク
- 243
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
icsharpcode/CodeConverter のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
icsharpcode/CodeConverter#1271 · コメント 1 件 ·
-
C# -> VB: most pattern matching fails to convert対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンC# -> VB
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
icsharpcode/CodeConverter#1281 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
icsharpcode/CodeConverter#1275 ·
-
VB -> C#: Handleres of sub properties being untracked対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンVB -> C#
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
icsharpcode/CodeConverter#1273 ·
-
VB -> C#: "Group By Into" Linq queries supressing aggregations ("Into" part) in the converted codeオープンDifficult area VB -> C#
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
icsharpcode/CodeConverter#1272 ·
icsharpcode/CodeConverter の issue をすべて見る
似ている issue
-
[Doc Gap] Document new --enable-public-network-access breaking change for azurebackup vault createオープンcopilot documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
area-dashboard
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
0 - Backlog Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
BrighterCommand/Brighter#4539 ·
メンテナーはふだん 1 日以内に返信
-
area-networking
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
dotnet/aspnetcore#69671 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Ignored test: FileLocalDataSourceTests.retries_loading_file対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンtest
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NethermindEth/nethermind#14274 ·
メンテナーはふだん 1 日以内に返信