roslynator
roslynator copied to clipboard
Under .NET 8+ provide an analyzer promoting TimeProvider against direct use of DateTime.Now/UtcNow
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.