VB -> C#: Async modifier incorrectly retained on abstract method declarations
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 62/100
調査の方向性
The payload names no files, so begin by reproducing the snippet in the converter and searching the VB-to-C# path for where method modifiers such as Async, MustOverride and Overrides are translated. The fix should suppress async when the converted method has no body while preserving it on implementations, and add a regression test covering both the abstract and overriding declaration. Done means the abstract method emits public abstract Task TestMethod(); and the override still uses async.
索引モデルが issue の本文から書いたものです。
説明
VB.Net input code
Imports System.Threading.Tasks
MustInherit Class TestClass
Public MustOverride Async Function TestMethod() As Task
End Class
Class ChildClass
Inherits TestClass
Public Overrides Async Function TestMethod() As Task
Await Task.Delay(1)
End Function
End Class
Erroneous output
using System.Threading.Tasks;
internal abstract partial class TestClass
{
public abstract async Task TestMethod();
}
internal partial class ChildClass : TestClass
{
public override async Task TestMethod()
{
await Task.Delay(1);
}
}
The abstract declaration produces:
CS1994: The 'async' modifier can only be used in methods that have a body.
Expected output
using System.Threading.Tasks;
internal abstract partial class TestClass
{
public abstract Task TestMethod();
}
internal partial class ChildClass : TestClass
{
public override async Task TestMethod()
{
await Task.Delay(1);
}
}
Details
- Product in use: VS extension, built locally from master.
- Version in use: 10.0.1, local development build.
- Did you see it working in a previous version, which? No.
- The converter retains the VB
Asyncmodifier on a bodylessMustOverridedeclaration, producing invalid C#. - Bodyless declarations should omit
async, while methods with an implementation should retain it. TheTaskreturn type is preserved in both cases.
- 主要言語
- C#
- スター
- 917
- フォーク
- 243
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
icsharpcode/CodeConverter のほかの issue
-
VB -> C#
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
icsharpcode/CodeConverter#1301 ·
メンテナーはふだん 3 日以内に返信
-
難易度 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#1298 ·
メンテナーはふだん 3 日以内に返信
icsharpcode/CodeConverter の issue をすべて見る
似ている issue
-
The Recommended preset turns on Import Uno DSP, which only works with the Material theme対応中かも @agneszitte が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
unoplatform/uno.templates#2388 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
eyalgolan/statecraft-israel#2732 ·
メンテナーはふだん 1 日以内に返信
-
要トリアージ
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
kind/chore status/draft
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Altinn/altinn-events#1158 ·
メンテナーはふだん 1 日以内に返信
-
S: Untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Trauma-Station/Trauma-Station#5285 ·
メンテナーはふだん 1 日以内に返信