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#: ASP.NET Inherits-attribute in aspx file does not get renamed properly #1088

Open
WalterWigman-Iress opened this issue Apr 3, 2024 · 0 comments
Labels
VB -> C# Specific to VB -> C# conversion

Comments

@WalterWigman-Iress
Copy link

WalterWigman-Iress commented Apr 3, 2024

VB.Net input code

In VB.net, a class can contain a method with the same name as the class. Lets call this class 'someclass'. In the aspx file, a reference is made to this file using 
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="SomeClass.aspx.vb" Inherits="SomeClass" ViewStateMode="Disabled" %>

with someclass.aspx.vb looking like this:
Public Class SomeClass
    Inherits BaseWebPage

    Private Sub SomeClass()
    'do nothing
    End Sub
End Class

Erroneous output

When converted to c#, the method name can't be the same as the classname, so the converter changes the classname, and appends 'Type', resulting in:
public class SomeClassType : BaseWebPage
{   
    private void SomeClass()
    {
        //do nothing
    }
}

However, the attribute Inherits="SomeClass" in the aspx file should also be changed into Inherits="SomeClassType", which does not happen currently. This won't be picked up during compilation, only at runtime, where the page will throw a 500 error, because the class-behind can't be found. 
Currently, the aspx-file is not touched at all: the reference to the vb-codehind stays unchanged (instead it should be changed to .cs, but this doesn't actually impact the application so just mentioning this as a side-note). 

Expected output

Must have: In the aspx-files, it should have it's Inherits-attribute changed if the classname changes.
Should have: In the aspx-files, change the CodeBehind value from .vb to .cs :)

Details

  • Product in use: e.g. both
  • Version in use: e.g. 9.2.5.0
  • Did you see it working in a previous version: no
@WalterWigman-Iress WalterWigman-Iress added the VB -> C# Specific to VB -> C# conversion label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

1 participant