Skip to content
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

TestScheduler throws NullReferenceException when subscribed is less than created #1114

Closed
NickLydon opened this issue Dec 20, 2019 · 0 comments · Fixed by #1115
Closed

TestScheduler throws NullReferenceException when subscribed is less than created #1114

NickLydon opened this issue Dec 20, 2019 · 0 comments · Fixed by #1115

Comments

@NickLydon
Copy link

NickLydon commented Dec 20, 2019

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?

4.3.1

What are the platform(s), environment(s) and related component version(s)?

windows, netcoreapp2.2, XUnit tests

What is the use case or problem?

Using the TestScheduler Start overload Start<T>(Func<IObservable<T>> create, long created, long subscribed, long disposed) with a subscribed value lower than the created throws a null reference exception

What is the expected outcome?

Perhaps throwing an argument exception before it gets to that point?

What is the actual outcome?

null reference exception

What is the stacktrace of the exception(s) if any?

System.NullReferenceException : Object reference not set to an instance of an object.
   at Microsoft.Reactive.Testing.TestScheduler.<>c__DisplayClass4_0`1.<Start>b__1(IScheduler scheduler, Object state) in d:\a\1\s\Rx.NET\Source\src\Microsoft.Reactive.Testing\TestScheduler.cs:line 94
   at System.Reactive.Concurrency.VirtualTimeScheduler`2.<>c__DisplayClass4_0`1.<ScheduleAbsolute>b__0(IScheduler scheduler, TState state1) in d:\a\1\s\Rx.NET\Source\src\System.Reactive\Concurrency\VirtualTimeScheduler.cs:line 430
   at System.Reactive.Concurrency.ScheduledItem`1.Invoke() in d:\a\1\s\Rx.NET\Source\src\System.Reactive\Concurrency\ScheduledItem.cs:line 44
   at System.Reactive.Concurrency.VirtualTimeSchedulerBase`2.Start() in d:\a\1\s\Rx.NET\Source\src\System.Reactive\Concurrency\VirtualTimeScheduler.cs:line 174
   at Microsoft.Reactive.Testing.TestScheduler.Start[T](Func`1 create, Int64 created, Int64 subscribed, Int64 disposed) in d:\a\1\s\Rx.NET\Source\src\Microsoft.Reactive.Testing\TestScheduler.cs:line 97

Do you have a code snippet or project that reproduces the problem?

new TestScheduler().Start(
  () => Observable.Empty<int>(),
  100,
  99,
  1000
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants