Skip to content

Commit 0a15687

Browse files
authored
Merge pull request #2500 from javiercampos/dev
Call ConfigureAwait(false) on all library related await calls
2 parents 9d65b6d + 32fdfb9 commit 0a15687

395 files changed

Lines changed: 2006 additions & 1993 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ public static IApplicationBuilder UseJwtTokenMiddleware(this IApplicationBuilder
1111
{
1212
if (ctx.User.Identity?.IsAuthenticated != true)
1313
{
14-
var result = await ctx.AuthenticateAsync(schema);
14+
var result = await ctx.AuthenticateAsync(schema).ConfigureAwait(false);
1515
if (result.Succeeded && result.Principal != null)
1616
{
1717
ctx.User = result.Principal;
1818
}
1919
}
2020

21-
await next();
21+
await next().ConfigureAwait(false);
2222
});
2323
}
2424
}

framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
3333
TenantConfiguration tenant = null;
3434
if (resolveResult.TenantIdOrName != null)
3535
{
36-
tenant = await FindTenantAsync(resolveResult.TenantIdOrName);
36+
tenant = await FindTenantAsync(resolveResult.TenantIdOrName).ConfigureAwait(false);
3737
if (tenant == null)
3838
{
3939
//TODO: A better exception?
@@ -45,19 +45,19 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
4545

4646
using (_currentTenant.Change(tenant?.Id, tenant?.Name))
4747
{
48-
await next(context);
48+
await next(context).ConfigureAwait(false);
4949
}
5050
}
5151

5252
private async Task<TenantConfiguration> FindTenantAsync(string tenantIdOrName)
5353
{
5454
if (Guid.TryParse(tenantIdOrName, out var parsedTenantId))
5555
{
56-
return await _tenantStore.FindAsync(parsedTenantId);
56+
return await _tenantStore.FindAsync(parsedTenantId).ConfigureAwait(false);
5757
}
5858
else
5959
{
60-
return await _tenantStore.FindAsync(tenantIdOrName);
60+
return await _tenantStore.FindAsync(tenantIdOrName).ConfigureAwait(false);
6161
}
6262
}
6363
}

framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public async Task<ApplicationConfigurationDto> GetAsync()
4343

4444
configuration = await Cache.GetOrAddAsync(
4545
cacheKey,
46-
async () => await Proxy.Service.GetAsync(),
46+
async () => await Proxy.Service.GetAsync().ConfigureAwait(false),
4747
() => new DistributedCacheEntryOptions
4848
{
4949
AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(120) //TODO: Should be configurable. Default value should be higher (5 mins would be good).
5050
}
51-
);
51+
).ConfigureAwait(false);
5252

5353
if (httpContext != null)
5454
{

framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public RemoteFeatureChecker(ICachedApplicationConfigurationClient configurationC
1515

1616
public override async Task<string> GetOrNullAsync(string name)
1717
{
18-
var configuration = await ConfigurationClient.GetAsync();
18+
var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
1919
return configuration.Features.Values.GetOrDefault(name);
2020
}
2121
}

framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public RemoteLanguageProvider(ICachedApplicationConfigurationClient configuratio
1616

1717
public async Task<IReadOnlyList<LanguageInfo>> GetLanguagesAsync()
1818
{
19-
var configuration = await ConfigurationClient.GetAsync();
19+
var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
2020
return configuration.Localization.Languages;
2121
}
2222
}

framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ public RemotePermissionChecker(ICachedApplicationConfigurationClient configurati
1616

1717
public async Task<bool> IsGrantedAsync(string name)
1818
{
19-
var configuration = await ConfigurationClient.GetAsync();
19+
var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
2020

2121
return configuration.Auth.GrantedPolicies.ContainsKey(name);
2222
}
2323

2424
public async Task<bool> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name)
2525
{
2626
/* This provider always works for the current principal. */
27-
return await IsGrantedAsync(name);
27+
return await IsGrantedAsync(name).ConfigureAwait(false);
2828
}
2929
}
3030
}

framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ public RemoteSettingProvider(ICachedApplicationConfigurationClient configuration
1717

1818
public async Task<string> GetOrNullAsync(string name)
1919
{
20-
var configuration = await ConfigurationClient.GetAsync();
20+
var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
2121
return configuration.Setting.Values.GetOrDefault(name);
2222
}
2323

2424
public async Task<List<SettingValue>> GetAllAsync()
2525
{
26-
var configuration = await ConfigurationClient.GetAsync();
26+
var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false);
2727
return configuration
2828
.Setting.Values
2929
.Select(s => new SettingValue(s.Key, s.Value))

framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ public async Task<TenantConfiguration> FindAsync(string name)
3939

4040
tenantConfiguration = await Cache.GetOrAddAsync(
4141
cacheKey,
42-
async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name)),
42+
async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name).ConfigureAwait(false)),
4343
() => new DistributedCacheEntryOptions
4444
{
4545
AbsoluteExpirationRelativeToNow =
4646
TimeSpan.FromMinutes(5) //TODO: Should be configurable.
4747
}
48-
);
48+
).ConfigureAwait(false);
4949

5050
if (httpContext != null)
5151
{
@@ -67,13 +67,13 @@ public async Task<TenantConfiguration> FindAsync(Guid id)
6767

6868
tenantConfiguration = await Cache.GetOrAddAsync(
6969
cacheKey,
70-
async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id)),
70+
async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id).ConfigureAwait(false)),
7171
() => new DistributedCacheEntryOptions
7272
{
7373
AbsoluteExpirationRelativeToNow =
7474
TimeSpan.FromMinutes(5) //TODO: Should be configurable.
7575
}
76-
);
76+
).ConfigureAwait(false);
7777

7878
if (httpContext != null)
7979
{
@@ -95,7 +95,7 @@ public TenantConfiguration Find(string name)
9595

9696
tenantConfiguration = Cache.GetOrAdd(
9797
cacheKey,
98-
() => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name))),
98+
() => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name).ConfigureAwait(false))),
9999
() => new DistributedCacheEntryOptions
100100
{
101101
AbsoluteExpirationRelativeToNow =
@@ -123,7 +123,7 @@ public TenantConfiguration Find(Guid id)
123123

124124
tenantConfiguration = Cache.GetOrAdd(
125125
cacheKey,
126-
() => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id))),
126+
() => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id).ConfigureAwait(false))),
127127
() => new DistributedCacheEntryOptions
128128
{
129129
AbsoluteExpirationRelativeToNow =

framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
1212
{
1313
var list = InitilizeFormGroupContentsContext(context, output);
1414

15-
await output.GetChildContentAsync();
15+
await output.GetChildContentAsync().ConfigureAwait(false);
1616

1717
SetInnerOlTag(context, output);
1818
SetInnerList(context, output, list);

framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
1919

2020
var itemList = InitilizeCarouselItemsContentsContext(context, output);
2121

22-
await output.GetChildContentAsync();
22+
await output.GetChildContentAsync().ConfigureAwait(false);
2323

2424
SetOneItemAsActive(context, output, itemList);
2525
SetItems(context, output, itemList);

0 commit comments

Comments
 (0)