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

Aberta
#685 5 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@ATECoder já está trabalhando nisso.

Desde 23/12/2020.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
45/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
csharp
Domínio
devtools, tooling

Direção de pesquisa

Reproduza a conversão usando a propriedade VB mostrada na issue e compare o C# gerado com a saída esperada. Rastreie o tratamento do conversor para propriedades VB somente leitura que podem ser sobrescritas e, em seguida, adicione ou atualize um teste de regressão para a semântica do getter e do setter. A tarefa estará concluída quando o C# gerado não introduzir o setter inválido que causa CS0115.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
C#
Estrelas
918
Forks
244
Merge médio
1d 10h
PRs com merge (30d)
29

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de icsharpcode/CodeConverter

Todas as issues de icsharpcode/CodeConverter

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.