Skip to content

Commit cbd1f38

Browse files
chore: Update all samples to use the latest TFMs (#4782)
1 parent c25d450 commit cbd1f38

File tree

27 files changed

+257
-102
lines changed

27 files changed

+257
-102
lines changed

.github/actions/environment/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ runs:
109109
- name: Install .NET Workloads
110110
shell: bash
111111
run: |
112+
set -euo pipefail
112113
pwd
113114
dotnet workload restore \
114115
--temp-dir "${{ runner.temp }}" \
115116
--skip-sign-check
117+
dotnet workload restore test/AndroidTestApp/AndroidTestApp.csproj \
118+
--temp-dir "${{ runner.temp }}" \
119+
--skip-sign-check
120+
# Restore the Android test app explicitly to ensure runtime packs are available
121+
dotnet restore test/AndroidTestApp/AndroidTestApp.csproj -r android-x64 --nologo || true

samples/Sentry.Samples.Android/Sentry.Samples.Android.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net9.0-android35.0</TargetFramework>
3+
<TargetFramework>net10.0-android36.0</TargetFramework>
44
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
55
<OutputType>Exe</OutputType>
66
<Nullable>enable</Nullable>
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
<Router AppAssembly="@typeof(Program).Assembly">
1+
<Router AppAssembly="@typeof(App).Assembly" NotFoundPage="typeof(Pages.NotFound)">
22
<Found Context="routeData">
33
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
45
</Found>
5-
<NotFound>
6-
<LayoutView Layout="@typeof(MainLayout)">
7-
<p>Sorry, there's nothing at this address.</p>
8-
</LayoutView>
9-
</NotFound>
106
</Router>

samples/Sentry.Samples.AspNetCore.Blazor.Wasm/Pages/Catcher.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
private static class OtherStuffThrower
3030
{
3131
public static void DoSomething() => Thrower();
32-
private static void Thrower() => throw null;
32+
private static void Thrower() => throw null!;
3333
}
3434
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@page "/not-found"
2+
@layout MainLayout
3+
4+
<h3>Not Found</h3>
5+
<p>Sorry, the content you are looking for does not exist.</p>

samples/Sentry.Samples.AspNetCore.Blazor.Wasm/Pages/Thrower.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
private static class StuffThrower
3131
{
3232
public static void DoSomething() => Thrower();
33-
private static void Thrower() => throw null;
33+
private static void Thrower() => throw null!;
3434
}
3535
}

samples/Sentry.Samples.AspNetCore.Blazor.Wasm/Program.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Microsoft.AspNetCore.Components.Web;
12
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
23
using Sentry.Samples.AspNetCore.Blazor.Wasm;
34

@@ -7,20 +8,28 @@
78
builder.UseSentry(options =>
89
{
910
#if !SENTRY_DSN_DEFINED_IN_ENV
10-
// A DSN is required. You can set here in code, or you can set it in the SENTRY_DSN environment variable.
11+
// You must specify a DSN. On browser platforms, this should be done in code here.
1112
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
1213
options.Dsn = SamplesShared.Dsn;
14+
#else
15+
// To make things easier for the SDK maintainers we have a custom build target that writes the
16+
// SENTRY_DSN environment variable into an EnvironmentVariables class that is available for WASM
17+
// targets. This allows us to share one DSN defined in the ENV across desktop and mobile samples.
18+
// Generally, you won't want to do this in your own WASM applications - you should set the DSN
19+
// in code as above
20+
options.Dsn = EnvironmentVariables.Dsn;
1321
#endif
1422
options.Debug = true;
1523
});
1624

1725
builder.RootComponents.Add<App>("#app");
26+
builder.RootComponents.Add<HeadOutlet>("head::after");
1827
builder.Logging.SetMinimumLevel(LogLevel.Debug);
1928

2029
builder.Services.AddScoped(_ =>
2130
new HttpClient
2231
{
23-
BaseAddress = new(builder.HostEnvironment.BaseAddress)
32+
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
2433
});
2534
await builder.Build().RunAsync();
2635
}

samples/Sentry.Samples.AspNetCore.Blazor.Wasm/Properties/launchSettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
23
"iisSettings": {
34
"windowsAuthentication": false,
45
"anonymousAuthentication": true,
@@ -18,7 +19,7 @@
1819
},
1920
"Sentry.Samples.AspNetCore.Blazor.Wasm": {
2021
"commandName": "Project",
21-
"dotnetRunMessages": "true",
22+
"dotnetRunMessages": true,
2223
"launchBrowser": true,
2324
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
2425
"applicationUrl": "https://localhost:5001;http://localhost:5000",

samples/Sentry.Samples.AspNetCore.Blazor.Wasm/Sentry.Samples.AspNetCore.Blazor.Wasm.csproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
5-
<RunAOTCompilation>true</RunAOTCompilation>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
8+
<!--<RunAOTCompilation>true</RunAOTCompilation>--><!--see https://github.com/dotnet/runtime/issues/121975-->
69
</PropertyGroup>
710

811
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
@@ -15,8 +18,9 @@
1518
</PropertyGroup>
1619

1720
<ItemGroup>
18-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.8"/>
19-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.8" PrivateAssets="all"/>
21+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0"/>
22+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.0" PrivateAssets="all"/>
2023
<ProjectReference Include="..\..\src\Sentry.AspNetCore.Blazor.WebAssembly\Sentry.AspNetCore.Blazor.WebAssembly.csproj" />
2124
</ItemGroup>
25+
2226
</Project>

samples/Sentry.Samples.AspNetCore.Blazor.Wasm/Shared/MainLayout.razor

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
<NavMenu />
66
</div>
77

8-
<div>
9-
@Body
10-
</div>
8+
<main>
9+
<article class="content">
10+
@Body
11+
</article>
12+
</main>
1113
</div>

0 commit comments

Comments
 (0)