Skip to content

Align IObservable.OfType operator nullability with IEnumerable and IAsyncEnumerable. #2247

@koenigst

Description

@koenigst

This is a follow-up issue for #1525.

  • Library version: 6.1.0

Reproduction

With nullability analysis:

string?[] inputs = ["1", null];

var filteredE = inputs.OfType<string>();
var filteredAe = await inputs.ToAsyncEnumerable().OfType<string>().ToListAsync();
var filteredO = await inputs.ToObservable().OfType<string>().ToList();

Expected outcome

No warnings.

Actual Outcome

Warning on the last line: 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions