Skip to content

Custom debugging visualizer for VS, leveraging NodaTime to disambiguate DateTime instances

License

Notifications You must be signed in to change notification settings

zspitz/DateTimeVisualizer

Repository files navigation

DateTimeVisualizer

AppVeyor build status GitHub Release NuGet status of UI components package

A .NET DateTime value can potentially have multiple ambiguous meanings.

  • DateTime has no inherent timezone information associated with it, aside from the timezone determined (or not determined) by the DateTime.Kind property:

    • UTC (DateTimeKind.Utc)
    • local to the system (DateTimeKind.Local)
    • up for grabs (DateTimeKind.Unspecified)

    The same DateTime could refer to different instants in time depending on the timezone.

  • Even within a specific timezone, time cannot be expressed as a linear sequence of DateTimes -- there may be gaps (when the clock moves forward), or there may be places where the sequence doubles back (when the clock moves back). The combination of a DateTime and a time zone may refer to 1, 0 or 2 instants in time.

This project provides a custom debugging visualizer that maps out these possible instants for a given DateTime, using the NodaTime library. In addition, you can choose a list of timezones to apply to each of those possible instants.

Screenshot

  • As UTC: If the date/time is interpreted as UTC, it will refer to this instant. Because date/times in UTC are always in linear succession, this instant is unambiguous.

  • Local zone: The local timezone for the debuggee process.

  • As local -- earlier / later mapping: If the datetime is interpreted as local (to the system), it may refer to 1 instant (earlier mapping), 2 instants (earlier or later mapping), or 0 instants.

  • Additional zones: You can choose additional zones from the built-in NodaTime Tzdb and Bcl zone providers:

    Choose zone

Usage

Choose DateTime Visualizer from the magnifying glass dropdown on an expression which references a DateTime while in a Visual Studio debugging session. If there is only one entry, or you've previously chosen it, you can click directly on the magnifying glass.

The UI components (views and viewmodels) are also available as a NuGet package for use in your own applications.

Requirements / Supports

The visualizer provides two versions: one for VS 2019, and one for VS 2017. Theoretically, the 2017 version should also work with earlier versions of VS.

The visualizer can be used with a project targeting .NET Framework 4.5+, or .NET Standard 2.0 (which includes .NET Core 2.0+).

Installation

From the project's Releases page, download the ZIP file corresponding to your Visual Studio version (2019 or 2017). Then:

  1. Unblock the ZIP file
  2. Extract the files to the visualizers folder, preserving the required folder structure.

Uninstallation

To delete the visualizer:

  1. Navigate to the visualizer location. This can be done by clicking on the About link, and then clicking on the DateTimeVisualizer.dll link.
  2. Delete all files and folders whose name starts with DateTimeVisualizer. You can find these by typing name:DateTimeVisualizer in the Windows search box.

Build

The project makes use of submodules from Periscope and Periscope.Debuggee, so you need to clone or pull changes into the repo using --recurse-submodules, as described in the Git documentation.

Contributing / Feedback

Credits

About

Custom debugging visualizer for VS, leveraging NodaTime to disambiguate DateTime instances

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages