Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VB -> C#: Overloads modifier should not always be converted to new modifier #351

Closed
AngelSpeaks opened this issue Aug 7, 2019 · 2 comments
Labels
compilation error A bug where the converted output won't compile duplicate VB -> C# Specific to VB -> C# conversion

Comments

@AngelSpeaks
Copy link

This code:
protected new override void Dispose(bool Disposing)

Is issuing error CS0113 on all forms in the project.
Error CS0113 A member 'frmLicenseAgreement.Dispose(bool)' marked as override cannot be marked as new or virtual MTCB C:\AngelSpeaksSoftware-2019\MyTalking Communicator\frmLicenseAgreement.Designer.cs 21 Active

Original VB code:
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub

Converted C# code:
// Form overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]
protected new override void Dispose(bool Disposing)
{
if (Disposing)
{
if (!(components == null))
components.Dispose();
}
base.Dispose(Disposing);
}

image

@GrahamTheCoder GrahamTheCoder added compilation error A bug where the converted output won't compile VB -> C# Specific to VB -> C# conversion labels Aug 11, 2019
@GrahamTheCoder GrahamTheCoder changed the title VB -> C#: .Designer.vb files issue CS0113 errors VB -> C#: Overloads modifier should not always be converted to new modifier Aug 11, 2019
@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Aug 11, 2019

Wokaround: Do a find and replace, to replace " new override " with " override ", that should fix your issues.
Thanks for pointing out this issue - it's due to the multiple possible uses of the "Overloads" keyword in Visual Basic. It may be possible for the code converter to check which method is being overloaded in order to decide if the modifier is required

@GrahamTheCoder
Copy link
Member

Closing to track this on #431

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compilation error A bug where the converted output won't compile duplicate VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

2 participants