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

Kalpana 291 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.

Developer technologies | Windows Presentation Foundation
Developer technologies | Visual Studio | Debugging
0 comments No comments
{count} votes

Answer accepted by question author
  1. DaisyTian-1203 11,651 Reputation points Moderator
    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,726 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

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.