roslynator icon indicating copy to clipboard operation
roslynator copied to clipboard

Under .NET 8+ provide an analyzer promoting TimeProvider against direct use of DateTime.Now/UtcNow

Open mdesalvo opened this issue 6 months ago • 0 comments

With .NET 8,Microsoft has finally delivered a unified abstraction for dealing with DateTime stuff in a controlled and mockable way. TimeProvider should be suggested as a replace for the direct use of DateTime.Now, DateTime.UtcNow and DateTime.Today: when running under .NET 8+ an analyzer emitting a warning would be very helpful.

mdesalvo avatar May 04 '25 13:05 mdesalvo