Skip to content

Commit ec71fbb

Browse files
Remove async await issue comments
1 parent 8c6d880 commit ec71fbb

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

src/Web/WebMVC/ViewComponents/CartList.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,7 @@ public async Task<IViewComponentResult> InvokeAsync(ApplicationUser user)
1919
var item = await GetItemsAsync(user);
2020
return View(item);
2121
}
22-
23-
// Notice that this method is a Task
24-
// returning asynchronous method. But, it does not
25-
// have the 'async' modifier, and does not contain
26-
// any 'await statements.
27-
// The only asynchronous call is the last (or only)
28-
// statement of the method. In those instances,
29-
// a Task returning method that does not use the
30-
// async modifier is preferred. The compiler generates
31-
// synchronous code for this method, but returns the
32-
// task from the underlying asynchronous method. The
33-
// generated code does not contain the state machine
34-
// generated for asynchronous methods.
35-
// Contrast that with the method above, which calls
36-
// and awaits an asynchronous method, and then processes
37-
// it further.
22+
3823
private Task<Basket> GetItemsAsync(ApplicationUser user) => _cartSvc.GetBasket(user);
3924
}
4025
}

0 commit comments

Comments
 (0)