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

DateTimeOffset comparison on Debug Console totally messed up #1677

Closed
cateyes99 opened this issue Aug 1, 2017 · 6 comments
Closed

DateTimeOffset comparison on Debug Console totally messed up #1677

cateyes99 opened this issue Aug 1, 2017 · 6 comments

Comments

@cateyes99
Copy link

cateyes99 commented Aug 1, 2017

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1
 Commit SHA-1 hash:  005db40cd1

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.11
 OS Platform: Darwin
 RID:         osx.10.11-x64
 Base Path:   /usr/local/share/dotnet/sdk/1.0.1

VS Code version: 1.14.2
C# Extension version: 1.11.0

Steps to reproduce

Given the below code

            var dtString = "2017-07-27T00:00:00Z";
            var d = DateTimeOffset.Parse(dtString);
            var d2 = DateTimeOffset.Parse(dtString);
            var f = d == d2;
            var f2 = d > d2;
            var f3 = d2 > d;
            var f4 = d < d2;
            var f5 = d2 < d;

When debugging it, in the Show Dedug window I can see f is true, as well as f2, f3, f4 and f5 are all false which are correct. But if I do comparisons of d and d2 in the Debug Console then odd things happened!

Expected behavior

d == d2
true
d > d2
false
d2 > d
false
d < d2
false
d2 < d
false

Actual behavior

d == d2
false
d > d2
true
d2 > d
true
d < d2
false
d2 < d
false
@gregg-miskelly
Copy link
Contributor

This looks like a bug in CoreCLR. It was fixed in .net core CLR 2.0 if you want to give it a try. I can try and help more when I get back from vacation if needed.

@cateyes99
Copy link
Author

cateyes99 commented Aug 1, 2017

@gregg-miskelly if it's a bug from CoreCLR, why the following code in the program works at runtime and debugging, but those statements i mentioned above malfunctioned in the Debug Console then?

            var f = d == d2;
            var f2 = d > d2;
            var f3 = d2 > d;
            var f4 = d < d2;
            var f5 = d2 < d;

@gregg-miskelly
Copy link
Contributor

Because the low level debugging support is in CoreCLR, and that is where the bug was.

@cateyes99
Copy link
Author

cateyes99 commented Aug 2, 2017

i've tried the same code on Windows 10 with:
dotnet --info output:

.NET Command Line Tools (1.0.4)

Product Information:
 Version:            1.0.4
 Commit SHA-1 hash:  af1e6684fd

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.4

VS Code version: 1.10.2
C# Extension version: 1.8.1

It doesn't have this issue. I'll try it on .NET Core CLR 2.0 preview 2

@cateyes99
Copy link
Author

cateyes99 commented Aug 3, 2017

Tried to install .NET Core CLR 2.0 preview 2 on my Mac, but cannot run it, because Apple macOS 10.12 is required for it (see https://github.com/dotnet/cli/issues/6591), my one is Apple OS X 10.11.6.

On Windows 10, .NET Core CLR 2.0 preview 2also doesn't have this issue.

dotnet --info output:

.NET Command Line Tools (2.0.0-preview2-006497)

Product Information:
 Version:            2.0.0-preview2-006497
 Commit SHA-1 hash:  06a2093335

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0-preview2-006497\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview2-25407-01
  Build    : 40c565230930ead58a50719c0ec799df77bddee9

@cateyes99
Copy link
Author

cateyes99 commented Aug 4, 2017

@gregg-miskelly So i've upgraded my OS X 10.11.6 to macOS 10.12, and debugged it with the same version of VS Code and Omnisharp extension on .NET Core CLR 2.0 preview 2. It does not have this issue.

So this can be closed, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants