How to debug in Visual Studio where there is a timespan feature specified

Kalpana 286 Reputation points
2020-10-09T07:06:29.727+00:00

Hi

I am writing a C# wpf app, and there are calls for timers in it and the timer has a timespan feature in it, for example. These timespans's are specified as TimeSpan.FromHours(1).
How do I debug these lines to see if the method below it gets executed, I tried changing my system's time, but it did not work

Please advice.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,710 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
967 questions
0 comments No comments
{count} votes

Accepted answer
  1. DaisyTian-1203 11,621 Reputation points
    2020-10-12T03:33:53.307+00:00

    The Debuger can jump to the specified Code line,
    Way One: You can drag and drop yellow arrows to make specific statements execute or not.
    31561-1.gif

    Way Two:An easier way to jump to the target row is to hover the mouse pointer over the target row and see the right arrow icon with a green vertical bar. Hold down the CTRL key and click the left mouse button to move the yellow debugging arrow over. Then click Debug Next or F5 to run directly on the specified row.
    31562-2.gif


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. David Lowndes 4,711 Reputation points
    2020-10-09T07:46:33.43+00:00

    You wait for the time period to expire.
    If you want that to occur much sooner, break into your code where the period is set and set it to a lower value - which you can probably do by executing an alternative time period setting using the VS Immediate debug window.

    0 comments No comments