.NET Core Mercury, just "Date" is not valid?

Version 11.0.0.2717 in Mercury (I’ve only tried this in Water.)

In classic VB.NET, I can define a property or variable as just Date instead of DateTime, and it compiles and runs fine. This also seems to work in a standard VB .NET Core project in Visual Studio.

But in my test ASP.NET Core Mercury project, I am getting an Unknown Type error:

Not a big deal if this isn’t going to be supported going forward, because as near as I can tell it still treats it as a DateTime. Even the tooltip in Visual Studio shows it as a DateTime.
image

But I’m thinking if I had existing VB.NET code I was moving to Mercury, it might be kind of a pain.

I haven’t tested any other scenarios (like standard .NET).

–Avonelle

Hmm. pretty sure we had an alias to DateTime. let me check…

Module Program

  Sub Main(args as String())
    writeLn("The magic happens here.")
    
    Dim X As Date
    writeLn($"x {X}")
  End Sub

End Module

this compiles fine for me in a new project, what could I be missing?

Hmmmm…You are right, works fine for me with a .NET Classic console app and a .NET Core console app.

Let me see if I can figure out what the difference is…

–Avonelle

1 Like

I think it is something specific to ASP.NET Core projects. Adding a simple variable declaration of Date fails for both the “ASP.NET Core MVC/Razor-based Web application” and “ASP.NET Core Empty Web Application” project templates. But it compiled fine for a classic Windows app.

FYI: I also see that “Date” doesn’t show up in the CC list in my test projects for ASP.NET Core but it does in the classic Windows app.

–Avonelle

Hmm, it looks like the template misses a reference to Mercury.dll. Adding that fixes it. I’ll fix the templates.

Excellent. Thanks!

–Avonelle

1 Like