Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

C# -> VB: Expected VB code is invalid in the test Conflict_DeclarationsAfterConvertionForToWhileAsync

オープン
#972 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp, visualbasic
領域
tooling

調査の方向性

Tests/VB/StatementTests.cs の Conflict_DeclarationsAfterConvertionForToWhileAsync(896 行目付近)から始め、そのテストを実行して無効な VB 出力を再現します。C# の for-loop 変換を追跡し、issue の期待される出力と比較します。テストが個別のループスコープと期待される For-loop 形式を持つ有効な VB を生成すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

C# -> VB
Input code
class TestClass {
    double height;
    void TestMethod() {
        for(double y = 0d; y < height; y += 10d)
            Draw(y);
        for(double y = 0d; y < height; y += 20d)
            Draw(y);
    }
    void Draw(double height) {
    }
}
Erroneous output
Friend Class TestClass
    Private height As Double

    Private Sub TestMethod()
        Dim y As Double = 0R

        While y < height
            Me.Draw(y)
            y += 10R
        End While

        Dim y As Double = 0R

        While y < height
            Me.Draw(y)
            y += 20R
        End While
    End Sub

    Private Sub Draw(ByVal height As Double)
    End Sub
End Class
Expected output
Friend Class TestClass
    Private height As Double

    Private Sub TestMethod()
        For y As Double = 0R To height - 1 Step 10R
            Draw(y)
        Next
        For y As Double = 0R To height - 1 Step 20R
            Draw(y)
        Next
    End Sub

    Private Sub Draw(height As Double)
    End Sub
End Class
Details

In Conflict_DeclarationsAfterConvertionForToWhileAsync test method starting on line 896.
https://github.com/icsharpcode/CodeConverter/blob/master/Tests/VB/StatementTests.cs

The error is the variable y is declared twice in the method.

Not sure why a C# for loop is being converted to a VB while loop.

主要言語
C#
スター
914
フォーク
242
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

icsharpcode/CodeConverter のほかの issue

icsharpcode/CodeConverter の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。