FakeTimeProvider with auto advance enabled - should calling ToString() cause time to advance? #4268
Labels
area-fundamentals
good first issue
Good for newcomers.
help wanted
Up for grabs. We would accept a PR to help resolve this issue
I was looking over the code and noticed that
ToString()
callsGetUtcNow()
. IfAutoAdvanceAmount
is greater than zero, then this would advance time whenever ToString is invoked.In normal operations that is likely not going to cause problems, but if I understand how (visual) debuggers work correctly e.g. the ones in Visual Studio, if I am debugging my app and I am inspecting a FakeTimeProvider instance, VS will call
ToString()
causing the clock to advance. That is going to make debugging time-related issues pretty damn hard.I think the fix is pretty simple:
The text was updated successfully, but these errors were encountered: