Skip to content

IAsyncEnumerable<T> enumerator does not compile with net 40 #198

@ig-sinicyn

Description

@ig-sinicyn

Example:

	public async IAsyncEnumerable<string?> EnumerateAsync()
	{
		await TaskEx.Yield();
		yield return "Hello!";
	}

produces CS1729 'ValueTask<bool>' does not contain a constructor that takes 2 arguments error.

The reason is, compilers calls ValueTask() ctor that requires IValueTaskSource and the ctor is not available under net40:

    [DebuggerHidden]
    ValueTask IAsyncDisposable.DisposeAsync()
    {
      // ...
      // fails here:
      return new ValueTask((IValueTaskSource) this, this.<>v__promiseOfValueOrEnd.Version);
    }

BTW, is the project alive now, or it was taken on hold? If the latter - its sad but thanks for the great library anyways!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions