A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/dotnet/reactive/issues/1525 below:

Fix warning when using nullable reference types with OfType operator · Issue #1525 · dotnet/reactive · GitHub

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?
v5.0

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

What is the use case or problem?
I want to use the OfType operator for filtering out nulls like so:

Observable
    .Return<string?>("blah")
    .OfType<string>()
    .SelectMany(this.audioService.PlayAudioPair)
    .Subscribe();

What is the expected outcome?
No warnings

What is the actual outcome?
When compiled has a warning:
warning CS8620: Argument of type 'IObservable<string?>' cannot be used for parameter 'source' of type 'IObservable<object>' in 'IObservable<string> Observable.OfType<string>(IObservable<object> source)' due to differences in the nullability of reference types.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4