I'm developing Blazor Server web application, and I'm torn on using .ConfigureAwait(false). I know that I shouldn't use it in component code, but I'm not sure about nested code. For example: I'm calling async method to update data on page on button click. This method itself also calls async method to make request to the API. Question is - should this nested method (API request) be called with ConfigureAwait(false) or not?
Edit: Adding Code to demonstrate more clearly:
This method is called from button OnClick
protected async Task GridRefresh()
{
Models = null;
_errorMessage = null;
try
{
Models = await _dataService.GetDataAsync(Active);
}
catch (Exception ex)
{
_errorMessage = ex.Message.Split("Message:").Last();
}
}
This method is located in DataService class that I add to my component using Dependency Injection
public async Task<IEnumerable<ItemViewModel>> GetDataAsync(int id)
{
var container = await ApiWrapper.getByIDAsync(id);
if(container == null)
throw new Exception($"Container with code {id} not found!");
return container.Items;
}
Question is: should I use ConfigureAwait in GetDataAsync method?
var container = await ApiWrapper.getByIDAsync(id).ConfigureAwait(false);