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

Đang mở
#685 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@ATECoder đang làm issue này rồi.

Từ ngày 23/12/2020.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
csharp
Lĩnh vực
devtools, tooling

Hướng nghiên cứu

Tái hiện quá trình chuyển đổi bằng cách sử dụng thuộc tính VB được nêu trong issue và so sánh C# được tạo ra với đầu ra mong đợi. Theo dõi cách converter xử lý các thuộc tính VB chỉ đọc có thể ghi đè, sau đó thêm hoặc cập nhật một kiểm thử hồi quy cho ngữ nghĩa của getter và setter. Hoàn thành khi C# được tạo ra không đưa vào setter không hợp lệ gây ra CS0115.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
C#
Star
918
Fork
244
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
29

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của icsharpcode/CodeConverter

Tất cả issue của icsharpcode/CodeConverter

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.