VB -> C#: CS0115 no suitable method found to override

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

メンテナーはふだん 1 日以内に返信

@ATECoder がすでに取り組んでいます。

2020年12月23日 から。

評価

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

調査の方向性

issue に示されている VB プロパティを使用して変換を再現し、生成された C# と期待される出力を比較します。コンバーターによる VB のオーバーライド可能な読み取り専用プロパティの処理を追跡し、その後、getter と setter のセマンティクスに関する回帰テストを追加または更新します。生成された C# が CS0115 の原因となる無効な setter を導入しなければ完了です。

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

説明

compilation error Good for coding agent VB -> C#
Input code
Protected Overridable ReadOnly Property AutoClearEnabledQueryCommand As String
Erroneous output
protected virtual string AutoClearEnabledQueryCommand { get; private set; }
Expected output
protected virtual string AutoClearEnabledQueryCommand { get; set; }
Details
  • Product in use: both
  • Version in use: 8.2.1
  • Did you see it working in a previous version, which? n/a
  • Any other relevant information to the issue, or your interest in contributing a fix.
    Clearly, this seems to expose another conflict between VB and C#, which entails a breaking change.

CS0115 appears on the 'set' element.

It seems that the C# implementation would work if the VB code property is changed to Read/Write.

Protected Overridable Property AutoClearEnabledQueryCommand As String
protected virtual string AutoClearEnabledQueryCommand { get; set; }

If the VB code is not changed before the conversion, the converted code is bound to cause a breaking change. What is implemented on the converter side, then, is a matter of style and perhaps could be informed by having a set of configuration settings. Such settings could also be used, for example, to address the issue of the resources: replace or add in root.

It would seems if the VB cothat the VB code My take is that the VB code needs to change before conversion

主要言語
C#
スター
918
フォーク
244
平均マージ
1日 10時間
マージ済み PR(30日)
29

環境構築

はじめの一歩

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

icsharpcode/CodeConverter のほかの issue

icsharpcode/CodeConverter の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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