Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mdesalvo opened this issue May 4, 2025 · 0 comments

Comments

@mdesalvo
Copy link

mdesalvo commented May 4, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant