diff --git a/src/ExpressionEvaluator/Core/Source/ResultProvider/Formatter.Values.cs b/src/ExpressionEvaluator/Core/Source/ResultProvider/Formatter.Values.cs index ae07e2cee584aca6801846c4828455061f708fb0..7c2d12fab6c6aa7178cd46f46da8c6eaf429b860 100644 --- a/src/ExpressionEvaluator/Core/Source/ResultProvider/Formatter.Values.cs +++ b/src/ExpressionEvaluator/Core/Source/ResultProvider/Formatter.Values.cs @@ -383,10 +383,10 @@ private string FormatPrimitive(DkmClrValue value, ObjectDisplayOptions options, object obj; if (value.Type.GetLmrType().IsDateTime()) { - DkmClrValue dateDataValue = value.GetFieldValue(DateTimeUtilities.DateTimeDateDataFieldName, inspectionContext); + DkmClrValue dateDataValue = value.GetPropertyValue("Ticks", inspectionContext); Debug.Assert(dateDataValue.HostObjectValue != null); - obj = DateTimeUtilities.ToDateTime((ulong)dateDataValue.HostObjectValue); + obj = new DateTime((long)dateDataValue.HostObjectValue); } else { diff --git a/src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs b/src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs index 4aa86a77a4a62795923e53d3e6e540261e29cd80..8a3636e0b95198e1d0d83c4f5486c2c76db317ec 100644 --- a/src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs +++ b/src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs @@ -330,6 +330,11 @@ internal static DkmClrValue GetFieldValue(this DkmClrValue value, string name, D return value.GetMemberValue(name, (int)MemberTypes.Field, ParentTypeName: null, InspectionContext: inspectionContext); } + internal static DkmClrValue GetPropertyValue(this DkmClrValue value, string name, DkmInspectionContext inspectionContext) + { + return value.GetMemberValue(name, (int)MemberTypes.Property, ParentTypeName: null, InspectionContext: inspectionContext); + } + internal static DkmClrValue GetNullableValue(this DkmClrValue value, Type nullableTypeArg, DkmInspectionContext inspectionContext) { var valueType = value.Type.GetLmrType(); diff --git a/src/Test/PdbUtilities/Shared/DateTimeUtilities.cs b/src/Test/PdbUtilities/Shared/DateTimeUtilities.cs index 6c44b3904d821c190a2deaf29909c9f2fa6aa2cc..5a94896cdbc3092241ed4edbf23c56b5a6d0e949 100644 --- a/src/Test/PdbUtilities/Shared/DateTimeUtilities.cs +++ b/src/Test/PdbUtilities/Shared/DateTimeUtilities.cs @@ -6,8 +6,6 @@ namespace Roslyn.Utilities { internal static class DateTimeUtilities { - internal const string DateTimeDateDataFieldName = "dateData"; - // From DateTime.cs. private const long TicksMask = 0x3FFFFFFFFFFFFFFF; @@ -18,13 +16,5 @@ internal static DateTime ToDateTime(double raw) var tickCount = BitConverter.DoubleToInt64Bits(raw) & TicksMask; return new DateTime(tickCount); } - - internal static DateTime ToDateTime(ulong raw) - { - // This mechanism for getting the tick count from the underlying ulong field is copied - // from System.DateTime.InternalTicks (ndp\clr\src\BCL\System\DateTime.cs). - var tickCount = unchecked((long)raw) & TicksMask; - return new DateTime(tickCount); - } } }