Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

List<T>.ForEach converts your async lambda into async void, as it accepts an Action<T>. Although it does that and that has some complications with exception handling, your ForEach call should work properly. If not, you might not be using the async pattern correctly. I would advise you to set a breakpoint after the first await and see the continuation executing.

I would advise you to use a regular foreach instead:

private async Task ProcessAllItemsAsync(List<Item> items) { foreach (var item in items) { var response = await Processor.IOBoundTaskAsync(item); // Some further processing on the response object. } } 

Read How can I use Async with ForEach?How can I use Async with ForEach? for more.

List<T>.ForEach converts your async lambda into async void, as it accepts an Action<T>. Although it does that and that has some complications with exception handling, your ForEach call should work properly. If not, you might not be using the async pattern correctly. I would advise you to set a breakpoint after the first await and see the continuation executing.

I would advise you to use a regular foreach instead:

private async Task ProcessAllItemsAsync(List<Item> items) { foreach (var item in items) { var response = await Processor.IOBoundTaskAsync(item); // Some further processing on the response object. } } 

Read How can I use Async with ForEach? for more.

List<T>.ForEach converts your async lambda into async void, as it accepts an Action<T>. Although it does that and that has some complications with exception handling, your ForEach call should work properly. If not, you might not be using the async pattern correctly. I would advise you to set a breakpoint after the first await and see the continuation executing.

I would advise you to use a regular foreach instead:

private async Task ProcessAllItemsAsync(List<Item> items) { foreach (var item in items) { var response = await Processor.IOBoundTaskAsync(item); // Some further processing on the response object. } } 

Read How can I use Async with ForEach? for more.

added 2 characters in body
Source Link
i3arnon
  • 117.3k
  • 33
  • 334
  • 358

List<T>.ForEach converts your async lambda into async void, as it accepts aan Action<T>. Although it does that anand that has some complications with exception handling, your ForEach call should work properly. If not, you might not be using the async pattern correctly. I would advise you to set a breakpoint after the first await and see the continuation executing.

I would advise you to use a regular foreach instead:

private async Task ProcessAllItemsAsync(List<Item> items) { foreach (var item in items) { var response = await Processor.IOBoundTaskAsync(item); // Some further processing on the response object. } } 

Read How can I use Async with ForEach? for more.

List<T>.ForEach converts your async lambda into async void, as it accepts a Action<T>. Although it does that an that has some complications with exception handling, your ForEach call should work properly. If not, you might not be using the async pattern correctly. I would advise you to set a breakpoint after the first await and see the continuation executing.

I would advise you to use a regular foreach instead:

private async Task ProcessAllItemsAsync(List<Item> items) { foreach (var item in items) { var response = await Processor.IOBoundTaskAsync(item); // Some further processing on the response object. } } 

Read How can I use Async with ForEach? for more.

List<T>.ForEach converts your async lambda into async void, as it accepts an Action<T>. Although it does that and that has some complications with exception handling, your ForEach call should work properly. If not, you might not be using the async pattern correctly. I would advise you to set a breakpoint after the first await and see the continuation executing.

I would advise you to use a regular foreach instead:

private async Task ProcessAllItemsAsync(List<Item> items) { foreach (var item in items) { var response = await Processor.IOBoundTaskAsync(item); // Some further processing on the response object. } } 

Read How can I use Async with ForEach? for more.

added 1 character in body
Source Link
Yuval Itzchakov
  • 150k
  • 32
  • 275
  • 333

List<T>.ForEach converts your async lambda into async void, as it accepts a Action<T>. Although it does that an that has some complications with exception handling, your ForEach call should work properly. If not, you might not be using the async pattern correctly. I would advise you to set a breakpoint after the first await and see the continuation executing.

I would advise you to seuse a regular foreach instead:

private async Task ProcessAllItemsAsync(List<Item> items) { foreach (var item in items) { var response = await Processor.IOBoundTaskAsync(item); // Some further processing on the response object. } } 

Read How can I use Async with ForEach? for more.

List<T>.ForEach converts your async lambda into async void, as it accepts a Action<T>. Although it does that an that has some complications with exception handling, your ForEach call should work properly. If not, you might not be using the async pattern correctly. I would advise you to set a breakpoint after the first await and see the continuation executing.

I would advise you to se a regular foreach instead:

private async Task ProcessAllItemsAsync(List<Item> items) { foreach (var item in items) { var response = await Processor.IOBoundTaskAsync(item); // Some further processing on the response object. } } 

Read How can I use Async with ForEach? for more.

List<T>.ForEach converts your async lambda into async void, as it accepts a Action<T>. Although it does that an that has some complications with exception handling, your ForEach call should work properly. If not, you might not be using the async pattern correctly. I would advise you to set a breakpoint after the first await and see the continuation executing.

I would advise you to use a regular foreach instead:

private async Task ProcessAllItemsAsync(List<Item> items) { foreach (var item in items) { var response = await Processor.IOBoundTaskAsync(item); // Some further processing on the response object. } } 

Read How can I use Async with ForEach? for more.

added 60 characters in body
Source Link
Yuval Itzchakov
  • 150k
  • 32
  • 275
  • 333
Loading
added 115 characters in body
Source Link
Yuval Itzchakov
  • 150k
  • 32
  • 275
  • 333
Loading
Source Link
Yuval Itzchakov
  • 150k
  • 32
  • 275
  • 333
Loading