dotnet / dotnet/reactive

Observable.Timer TimeSpan.FromTicks(30) stop working after two executes.

Open
#1,520 8 comments 0 reactions 0 assignees View on GitHub
[area] Rx
Dominant language
C#
Stars
7.2k
Forks
798
PR merge metrics
No merged PRs in 30d

Description

Hello and thank you for using dotnet/reactive. Please select a category and detail your issue by answering the questions there:

#### Bug

Despite our best efforts, bugs can slip into releases or corner cases forgotten about. We will try our best to remedy the situation
and/or provide workarounds. Note that certain (odd) behaviors are by design and as such are not considered bugs.

> Which library version?
5.0.0
> What are the platform(s), environment(s) and related component version(s)?
Windows 10 20H2 19042.867, with .net 5.0
> What is the use case or problem?
```
_recvObs = Observable.Timer(DateTimeOffset.Now.AddSeconds(5), TimeSpan.FromTicks(30));
_recvObs.Subscribe(RecvDataFunc);
```
> What is the expected outcome?
RecvDataFunc should working each 30 ticks
> What is the actual outcome?
RecvDataFunc works only twice (two times).
> What is the stacktrace of the exception(s) if any?
no exception
> Do you have a code snippet or project that reproduces the problem?
```
private IObservable _recvObs;
...
_recvObs = Observable.Timer(DateTimeOffset.Now.AddSeconds(5), TimeSpan.FromTicks(30));
_recvObs.Subscribe(RecvDataFunc);
...
private void RecvDataFunc(long i)
```

I've used the Thread to maintain TCP connections, as I saw reactive would be better easily doing the timer/task, and I simply replace the Thread with Observable as code shows above.
it works with TimeSpan.FromSeconds which inv large than 1 second, and zero value, but FromTicks(30).
It seems a bug for me, I've switched back to Thread.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.