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#: Incorrect class prefix for builtin date functions #261

Closed
mrmonday opened this issue Apr 5, 2019 · 1 comment · Fixed by #283
Closed

VB -> C#: Incorrect class prefix for builtin date functions #261

mrmonday opened this issue Apr 5, 2019 · 1 comment · Fixed by #283
Labels
compilation error A bug where the converted output won't compile VB -> C# Specific to VB -> C# conversion

Comments

@mrmonday
Copy link
Contributor

mrmonday commented Apr 5, 2019

Input code

Public Class Class1
    Sub Foo()
        Dim x = DateAdd("m", 5, Now)
    End Sub
End Class

Erroneous output

public class Class1
{
    public void Foo()
    {
        var x = DateTime.DateAdd("m", 5, DateTime.Now);
    }
}

Expected output

public class Class1
{
    public void Foo()
    {
        var x = DateAndTime.DateAdd("m", 5, DateTime.Now);
    }
}

Details

Product in use: e.g. VS extension

Version in use: e.g. 6.6.0

Built in date functions are in the DateAndTime class, not DateTime.

@GrahamTheCoder
Copy link
Member

At the moment I think there's a very blanket attempt to make things use DateTime rather than DateAndTime. It was in a very early effort to head in the direction of #174
Perhaps a nice improvement here would be to check for the existence of a DateTime symbol, and fall back on using the DateAndTime one.

@GrahamTheCoder GrahamTheCoder added VB -> C# Specific to VB -> C# conversion compilation error A bug where the converted output won't compile labels Apr 8, 2019
mrmonday added a commit to mrmonday/CodeConverter that referenced this issue Apr 17, 2019
GrahamTheCoder pushed a commit to mrmonday/CodeConverter that referenced this issue Apr 19, 2019
Closes icsharpcode#261

# Conflicts:
#	Tests/CSharp/ExpressionTests.cs
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 VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants