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

Aperta
#685 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ATECoder ci sta già lavorando.

Dal 23/12/2020.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp
Ambito
devtools, tooling

Direzione di ricerca

Riproduci la conversion utilizzando la proprietà VB mostrata nell’issue e confronta il C# generato con l’output previsto. Traccia la gestione da parte del convertitore delle proprietà VB di sola lettura sovrascrivibili, quindi aggiungi o aggiorna un test di regressione per la semantica di getter e setter. Il lavoro è completato quando il C# generato non introduce il setter non valido che causa CS0115.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
C#
Stelle
918
Fork
244
Merge medio
1g 10h
PR unite (30g)
29

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di icsharpcode/CodeConverter

Tutte le issue di icsharpcode/CodeConverter

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.