Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

What is meaning of this extension? #3

Closed
tiksn opened this issue Jan 22, 2017 · 3 comments
Closed

What is meaning of this extension? #3

tiksn opened this issue Jan 22, 2017 · 3 comments

Comments

@tiksn
Copy link

tiksn commented Jan 22, 2017

Please add readme.
why and how should we use it?
Can you also add analyzer for replacing "DateTime" with "DateTimeOffset"?

@mihasic
Copy link
Owner

mihasic commented Jan 27, 2017

Will add readme when have more spare time, thought that extension is fairly simple and self-descriptive.

why and how should we use it?

Extension gives warnings on places with potential side effects related to DateTime. Developed as a result of multiple discussions and big refactoring within the company I work.
DateTime.Now and similar can lead to some side effects in the code. Best practice is to have an abstraction somewhere on the top level. So in tests it would be possible to have a stub (or use RX Scheduler) and have predictable results.

Can you also add analyzer for replacing "DateTime" with "DateTimeOffset"?

I would, when I'll be able to make VS2017 work on my machine (was going to port it). But, in general, it's not really the goal. DateTimeOffset.[Utc]Now - still brings a static mutable state to the application, which leads to side effects.

@mihasic
Copy link
Owner

mihasic commented Jan 27, 2017

found some similar discussion: DotNetAnalyzers/Proposals#9

@tiksn
Copy link
Author

tiksn commented Jan 27, 2017

Thank you for your response. And thanks for tool.

@mihasic mihasic mentioned this issue Mar 14, 2017
4 tasks
@tiksn tiksn closed this as completed Jan 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants