Can anyone tell me how the timeframe? Current
can be null in the following category?
Public Intangible Class TimeProvider {Private Static Time Provider Current = DefaultTimeProvider.Instance; Get public static timepriver {get {return timeprovider.current; } Set {if (value == null) {new argumentNullException ("value"); } TimeProvider.current = Value; }} Public Prime Datetime Youtube [get] } Public Fixed Zero ResetToDefault () {TimeProvider.current = DefaultTimeProvider.Instance; }}
Comments
- All unit tests that invite ResettooidFlow directly to their fixedshift turdahounds in the context of Timefriver Are there.
- Includes multithreaded code not in it.
- Once in a while, one of the unit tests fails because
TimeProvider.Current
is zero (NullReferenceException is thrown). - This only happens when I run the entire suit, but when I run a single unit test, I am suggesting that some microbial testing is inconvenience.
- It happens almost once every five or six test runs.
- When a failure occurs, it appears that the first coded tests are included in which
includes TimeProvider.Current
- more than one test failed But one may fail in a test test.
FWI, there is also the default TimeProvider class:
public class DefaultTop Provrovider: TimePrivier {Private Redonline Static Default Time PR Ovider Example = New DefaultTimeProvider (); Private Default Time Provider () {} Public Override Date Time UTCNow {Receive Date Date Utkennov; }} Public static DefaultTimeProvider example {return default TimeProvider.instance; I suspect that there are some subtle interactions that are some initially running, where the runtime is actually allowed to reach TimeProvider.Current
before the end of all the Stacey initialization. . FWIW I Throwed
Console.WriteLine (Thread.CurrentThread.ManagedThreadId); Greater
, and it constantly reports the same ID for all test cases, so this issue does not seem to be related to threading.
This code is fully based, current
may be < Code> null being set based on null
. This is clearly not helpful for you.
Can you provide the code for the test? If there is a test civilization, it would be helpful to give any feedback to the readers.
In the mean time, an article on John Skate's singular might possibly be useful, because DefaultTimeProvider
is working effectively as a singleton:
/ Div>
Comments
Post a Comment