CodeConverter icon indicating copy to clipboard operation
CodeConverter copied to clipboard

VB -> C#: wrong conversion of CDate(Nothing)

Open KunzeAndreas opened this issue 3 years ago • 1 comments

Input code

Assert.That(CDate(Nothing) = New Date(1, 1, 1))

Erroneous output

Assert.That(Conversions.ToDate(default) == new DateTime(1, 1, 1));
throws System.InvalidCastException

Expected output

Assert.That(default(DateTime) == new DateTime(1, 1, 1));

Details

  • Product in use: VS extension
  • Version in use: 8.2.0.0
  • Did you see it working in a previous version, which? No

KunzeAndreas avatar Oct 25 '20 17:10 KunzeAndreas

Thanks. I'll expect there's a whole class of related bugs since date and DateTime have some differences. E.g. If code calls another vb library that returns a date, it needs to be converted to date time in some way. Same for parameters passed.

GrahamTheCoder avatar Oct 28 '20 08:10 GrahamTheCoder