Skip to content

Commit 39787b8

Browse files
authored
Merge pull request #14 from postsharp/topic/story-29346-postsharp610rc
PostSharp updated to 6.10.4-rc
2 parents 0d210c0 + 28de1b1 commit 39787b8

File tree

100 files changed

+7424
-6420
lines changed

Some content is hidden

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

100 files changed

+7424
-6420
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<Router AppAssembly="@typeof(Program).Assembly">
1+
<Router AppAssembly="@typeof(App).Assembly">
22
<Found Context="routeData">
33
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
45
</Found>
56
<NotFound>
7+
<PageTitle>Not found</PageTitle>
68
<LayoutView Layout="@typeof(MainLayout)">
7-
<p>Sorry, there's nothing at this address.</p>
9+
<p role="alert">Sorry, there's nothing at this address.</p>
810
</LayoutView>
911
</NotFound>
1012
</Router>

Blazor/PostSharp.Samples.Blazor.AutoRetry/Aspects/AutoRetryAttribute.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
using PostSharp.Aspects;
22
using PostSharp.Extensibility;
33
using PostSharp.Serialization;
4-
using System;
54
using System.Data;
6-
using System.Linq;
75
using System.Net;
8-
using System.Threading.Tasks;
96

107
namespace PostSharp.Samples.AutoRetry.Aspects
118
{
@@ -26,7 +23,7 @@ public AutoRetryAttribute()
2623
// Set the default values for properties.
2724
MaxRetries = 5;
2825
Delay = 3;
29-
HandledExceptions = new[] { typeof(WebException), typeof(DataException) };
26+
HandledExceptions = new[] { typeof(HttpRequestException), typeof(WebException), typeof(DataException) };
3027
}
3128

3229
/// <summary>

Blazor/PostSharp.Samples.Blazor.AutoRetry/LinkerConfig.xml

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace PostSharp.Samples.Blazor.AutoRetry.Model
2+
{
3+
public class WeatherForecast
4+
{
5+
public DateTime Date { get; set; }
6+
7+
public int TemperatureC { get; set; }
8+
9+
public string? Summary { get; set; }
10+
11+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12+
}
13+
}

Blazor/PostSharp.Samples.Blazor.AutoRetry/Pages/FetchData.razor

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
@page "/fetchdata"
2-
@inject HttpClient Http
1+
@page "/fetchdata"
2+
@using PostSharp.Samples.Blazor.AutoRetry.Model
33
@using PostSharp.Samples.Blazor.AutoRetry.Services
4+
@inject HttpClient Http
5+
6+
<PageTitle>Weather forecast</PageTitle>
47

58
<h1>Weather forecast</h1>
69

7-
<p>This component demonstrates fetching data from the server with auto-retry on connection failures.</p>
10+
<p>This component demonstrates fetching data from the server.</p>
811

9-
@if ( forecasts == null )
12+
@if (forecasts == null)
1013
{
1114
<p><em>Loading...</em></p>
1215
}
@@ -22,7 +25,7 @@ else
2225
</tr>
2326
</thead>
2427
<tbody>
25-
@foreach ( var forecast in forecasts )
28+
@foreach (var forecast in forecasts)
2629
{
2730
<tr>
2831
<td>@forecast.Date.ToShortDateString()</td>
@@ -36,7 +39,7 @@ else
3639
}
3740

3841
@code {
39-
private WeatherForecast[] forecasts;
42+
private WeatherForecast[]? forecasts;
4043

4144
protected override async Task OnInitializedAsync()
4245
{
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@page "/"
22

3-
<h1>Hello, world!</h1>
3+
<PageTitle>Index</PageTitle>
44

5-
Welcome to your new app.
5+
<h1>Hello, world!</h1>
66

7-
For more information about Blazor support in PostSharp check out our documentation at <a href="https://doc.postsharp.net/blazor">https://doc.postsharp.net/blazor</a>.
7+
Welcome to the PostSharp AutoRetry sample in WebAssembly.
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.1</TargetFramework>
5-
<RazorLangVersion>3.0</RazorLangVersion>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
67
</PropertyGroup>
78

89
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
10-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
11-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
12-
<PackageReference Include="PostSharp" Version="6.8.5-rc" />
13-
<PackageReference Include="System.Net.Http.Json" Version="3.2.0" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
12+
<PackageReference Include="PostSharp" Version="6.10.4-rc" />
1413
</ItemGroup>
15-
16-
<ItemGroup>
17-
<BlazorLinkerDescriptor Include="LinkerConfig.xml" />
18-
</ItemGroup>
19-
14+
2015
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
using System;
2-
using System.Net.Http;
3-
using System.Collections.Generic;
4-
using System.Threading.Tasks;
5-
using System.Text;
1+
using Microsoft.AspNetCore.Components.Web;
62
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
7-
using Microsoft.Extensions.Configuration;
8-
using Microsoft.Extensions.DependencyInjection;
9-
using Microsoft.Extensions.Logging;
3+
using PostSharp.Samples.Blazor.AutoRetry;
104

11-
namespace PostSharp.Samples.Blazor.AutoRetry
12-
{
13-
public class Program
14-
{
15-
public static async Task Main(string[] args)
16-
{
17-
var builder = WebAssemblyHostBuilder.CreateDefault(args);
18-
builder.RootComponents.Add<App>("app");
5+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
6+
builder.RootComponents.Add<App>("#app");
7+
builder.RootComponents.Add<HeadOutlet>("head::after");
198

20-
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
9+
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
2110

22-
await builder.Build().RunAsync();
23-
}
24-
}
25-
}
11+
await builder.Build().RunAsync();

Blazor/PostSharp.Samples.Blazor.AutoRetry/Properties/launchSettings.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@
33
"windowsAuthentication": false,
44
"anonymousAuthentication": true,
55
"iisExpress": {
6-
"applicationUrl": "http://localhost:1184",
6+
"applicationUrl": "http://localhost:2428",
77
"sslPort": 0
88
}
99
},
1010
"profiles": {
11-
"IIS Express": {
12-
"commandName": "IISExpress",
11+
"PostSharp.Samples.Blazor.AutoRetry": {
12+
"commandName": "Project",
13+
"dotnetRunMessages": true,
1314
"launchBrowser": true,
1415
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
16+
"applicationUrl": "http://localhost:5000",
1517
"environmentVariables": {
1618
"ASPNETCORE_ENVIRONMENT": "Development"
1719
}
1820
},
19-
"PostSharp.Samples.Blazor.AutoRetry": {
20-
"commandName": "Project",
21+
"IIS Express": {
22+
"commandName": "IISExpress",
2123
"launchBrowser": true,
2224
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23-
"applicationUrl": "http://localhost:5000",
2425
"environmentVariables": {
2526
"ASPNETCORE_ENVIRONMENT": "Development"
2627
}

Blazor/PostSharp.Samples.Blazor.AutoRetry/README.md

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,30 @@
11
using PostSharp.Samples.AutoRetry.Aspects;
2-
using System;
3-
using System.Net;
4-
using System.Net.Http;
2+
using PostSharp.Samples.Blazor.AutoRetry.Model;
53
using System.Net.Http.Json;
6-
using System.Threading.Tasks;
74

85
namespace PostSharp.Samples.Blazor.AutoRetry.Services
96
{
107
[AutoRetry]
118
public class WeatherService
129
{
1310
private int counter;
14-
private HttpClient httpClient;
11+
12+
private readonly HttpClient httpClient;
1513

1614
public WeatherService(HttpClient httpClient)
1715
{
1816
this.httpClient = httpClient;
1917
}
2018

21-
public async Task<WeatherForecast[]> GetCurrentForecast()
19+
public async Task<WeatherForecast[]?> GetCurrentForecast()
2220
{
2321
// Fail every other request.
2422
if (++counter % 2 == 1)
2523
{
26-
throw new WebException("Service unavailable.");
24+
throw new HttpRequestException("Service unavailable.");
2725
}
2826

2927
return await this.httpClient.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
3028
}
3129
}
32-
33-
public class WeatherForecast
34-
{
35-
public DateTime Date
36-
{
37-
get; set;
38-
}
39-
40-
public int TemperatureC
41-
{
42-
get; set;
43-
}
44-
45-
public string Summary
46-
{
47-
get; set;
48-
}
49-
50-
public int TemperatureF => 32 + (int) (TemperatureC / 0.5556);
51-
}
5230
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
@inherits LayoutComponentBase
22

3-
<div class="sidebar">
4-
<NavMenu />
5-
</div>
6-
7-
<div class="main">
8-
<div class="top-row px-4">
9-
<a href="https://www.postsharp.net/" target="_blank" class="ml-md-auto">About PostSharp</a>
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu />
106
</div>
117

12-
<div class="content px-4">
13-
@Body
14-
</div>
8+
<main>
9+
<div class="top-row px-4">
10+
<a href="https://www.postsharp.net/" target="_blank">About</a>
11+
</div>
12+
13+
<article class="content px-4">
14+
@Body
15+
</article>
16+
</main>
1517
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
.page {
2+
position: relative;
3+
display: flex;
4+
flex-direction: column;
5+
}
6+
7+
main {
8+
flex: 1;
9+
}
10+
11+
.sidebar {
12+
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
13+
}
14+
15+
.top-row {
16+
background-color: #f7f7f7;
17+
border-bottom: 1px solid #d6d5d5;
18+
justify-content: flex-end;
19+
height: 3.5rem;
20+
display: flex;
21+
align-items: center;
22+
}
23+
24+
.top-row ::deep a, .top-row ::deep .btn-link {
25+
white-space: nowrap;
26+
margin-left: 1.5rem;
27+
text-decoration: none;
28+
}
29+
30+
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31+
text-decoration: underline;
32+
}
33+
34+
.top-row ::deep a:first-child {
35+
overflow: hidden;
36+
text-overflow: ellipsis;
37+
}
38+
39+
@media (max-width: 640.98px) {
40+
.top-row:not(.auth) {
41+
display: none;
42+
}
43+
44+
.top-row.auth {
45+
justify-content: space-between;
46+
}
47+
48+
.top-row ::deep a, .top-row ::deep .btn-link {
49+
margin-left: 0;
50+
}
51+
}
52+
53+
@media (min-width: 641px) {
54+
.page {
55+
flex-direction: row;
56+
}
57+
58+
.sidebar {
59+
width: 250px;
60+
height: 100vh;
61+
position: sticky;
62+
top: 0;
63+
}
64+
65+
.top-row {
66+
position: sticky;
67+
top: 0;
68+
z-index: 1;
69+
}
70+
71+
.top-row.auth ::deep a:first-child {
72+
flex: 1;
73+
text-align: right;
74+
width: 0;
75+
}
76+
77+
.top-row, article {
78+
padding-left: 2rem !important;
79+
padding-right: 1.5rem !important;
80+
}
81+
}

0 commit comments

Comments
 (0)