Skip to content

Commit 4bd3048

Browse files
authored
Merge pull request #35607 from dotnet/main
2 parents 33a8473 + 0cf8e93 commit 4bd3048

File tree

2 files changed

+14
-38
lines changed

2 files changed

+14
-38
lines changed

aspnetcore/blazor/security/blazor-web-app-with-oidc.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,13 @@ public class TokenHandler(IHttpContextAccessor httpContextAccessor) :
193193
protected override async Task<HttpResponseMessage> SendAsync(
194194
HttpRequestMessage request, CancellationToken cancellationToken)
195195
{
196-
var accessToken = httpContextAccessor.HttpContext?
197-
.GetTokenAsync("access_token").Result ??
198-
throw new Exception("No access token");
196+
if (httpContextAccessor.HttpContext is null)
197+
{
198+
throw new Exception("HttpContext not available");
199+
}
200+
201+
var accessToken = await httpContextAccessor.HttpContext
202+
.GetTokenAsync("access_token");
199203

200204
request.Headers.Authorization =
201205
new AuthenticationHeaderValue("Bearer", accessToken);
@@ -526,9 +530,13 @@ public class TokenHandler(IHttpContextAccessor httpContextAccessor) :
526530
protected override async Task<HttpResponseMessage> SendAsync(
527531
HttpRequestMessage request, CancellationToken cancellationToken)
528532
{
529-
var accessToken = httpContextAccessor.HttpContext?
530-
.GetTokenAsync("access_token").Result ??
531-
throw new Exception("No access token");
533+
if (httpContextAccessor.HttpContext is null)
534+
{
535+
throw new Exception("HttpContext not available");
536+
}
537+
538+
var accessToken = await httpContextAccessor.HttpContext
539+
.GetTokenAsync("access_token");
532540

533541
request.Headers.Authorization =
534542
new AuthenticationHeaderValue("Bearer", accessToken);

aspnetcore/blazor/tutorials/movie-database-app/part-2.md

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,6 @@ dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
134134
> [!IMPORTANT]
135135
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
136136
137-
:::moniker range=">= aspnetcore-9.0 < aspnetcore-10.0"
138-
139-
<!-- UPDATE 10.0 - Remove at 10.0 GA -->
140-
141-
> [!IMPORTANT]
142-
> A breaking change in EF Core tooling for .NET 9.0.200 SDK prevented scaffolding from executing with the following exception:
143-
>
144-
> > :::no-loc text="Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.":::
145-
>
146-
> To resolve the error, upgrade to a .NET 9.0.300 or later SDK.
147-
>
148-
> For more information, see [Breaking changes in EF Core 9 (EF9)](/ef/core/what-is-new/ef-core-9.0/breaking-changes#microsoftentityframeworkcoredesign-not-found-when-using-ef-tools).
149-
150-
:::moniker-end
151-
152137
> [!NOTE]
153138
> The preceding commands are .NET CLI commands, and .NET CLI commands are executed when entered at a [PowerShell](/powershell/) prompt, which is the default command shell of the VS Code **Terminal**.
154139
@@ -191,23 +176,6 @@ dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdap
191176
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
192177
```
193178

194-
:::moniker range=">= aspnetcore-9.0 < aspnetcore-10.0"
195-
196-
<!-- UPDATE 10.0 - Remove at 10.0 GA -->
197-
198-
> [!IMPORTANT]
199-
> A breaking change in EF Core tooling for .NET 9.0.200 SDK prevented scaffolding from executing with the following exception:
200-
>
201-
> > :::no-loc text="Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.":::
202-
>
203-
> To resolve the error, upgrade to a .NET 9.0.300 or later SDK.
204-
>
205-
> For more information, see [Breaking changes in EF Core 9 (EF9)](/ef/core/what-is-new/ef-core-9.0/breaking-changes#microsoftentityframeworkcoredesign-not-found-when-using-ef-tools).
206-
207-
:::moniker-end
208-
209-
:::moniker-end
210-
211179
Save the project file.
212180

213181
The preceding commands add:

0 commit comments

Comments
 (0)