Skip to content

Commit e1cba58

Browse files
ejsmithniemyjski
andauthored
Blazor support (#288)
* #286 - Added sample blazor web assembly app * [Breaking] Made ISubmissionClient Async * [Breaking] Removed ProcessQueue, Shutdown and other sync methods for async impl Added extra error handling around unavoidable async void Co-authored-by: Blake Niemyjski <[email protected]>
1 parent 645a596 commit e1cba58

File tree

58 files changed

+1519
-223
lines changed

Some content is hidden

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

58 files changed

+1519
-223
lines changed

Exceptionless.Net.sln

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29209.152
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.33103.201
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{728C18BC-4085-4492-B0B2-8211CA209A50}"
77
ProjectSection(SolutionItems) = preProject
@@ -82,6 +82,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Exceptionless.SampleLambda"
8282
EndProject
8383
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Exceptionless.SampleLambdaAspNetCore", "samples\Exceptionless.SampleLambdaAspNetCore\Exceptionless.SampleLambdaAspNetCore.csproj", "{D9987952-B891-48B4-AA93-59AA39F33FC4}"
8484
EndProject
85+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exceptionless.SampleBlazorWebAssemblyApp", "samples\Exceptionless.SampleBlazorWebAssemblyApp\Exceptionless.SampleBlazorWebAssemblyApp.csproj", "{07D30684-0A2F-47E1-A3A7-6BEC248FBA06}"
86+
EndProject
8587
Global
8688
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8789
Debug|Any CPU = Debug|Any CPU
@@ -192,6 +194,10 @@ Global
192194
{D9987952-B891-48B4-AA93-59AA39F33FC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
193195
{D9987952-B891-48B4-AA93-59AA39F33FC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
194196
{D9987952-B891-48B4-AA93-59AA39F33FC4}.Release|Any CPU.Build.0 = Release|Any CPU
197+
{07D30684-0A2F-47E1-A3A7-6BEC248FBA06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
198+
{07D30684-0A2F-47E1-A3A7-6BEC248FBA06}.Debug|Any CPU.Build.0 = Debug|Any CPU
199+
{07D30684-0A2F-47E1-A3A7-6BEC248FBA06}.Release|Any CPU.ActiveCfg = Release|Any CPU
200+
{07D30684-0A2F-47E1-A3A7-6BEC248FBA06}.Release|Any CPU.Build.0 = Release|Any CPU
195201
EndGlobalSection
196202
GlobalSection(SolutionProperties) = preSolution
197203
HideSolutionNode = FALSE
@@ -222,6 +228,7 @@ Global
222228
{693ED127-0124-4697-8369-700717615E85} = {2CEE12C6-3840-4C01-A952-D3026B0A662A}
223229
{4B26BF7F-85FB-4B41-BF93-661E83A4EDD7} = {2CEE12C6-3840-4C01-A952-D3026B0A662A}
224230
{D9987952-B891-48B4-AA93-59AA39F33FC4} = {2CEE12C6-3840-4C01-A952-D3026B0A662A}
231+
{07D30684-0A2F-47E1-A3A7-6BEC248FBA06} = {2CEE12C6-3840-4C01-A952-D3026B0A662A}
225232
EndGlobalSection
226233
GlobalSection(ExtensibilityGlobals) = postSolution
227234
SolutionGuid = {EBB2CC85-FF87-431B-865F-2F110B2A10E6}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<PageTitle>Not found</PageTitle>
8+
<LayoutView Layout="@typeof(MainLayout)">
9+
<p role="alert">Sorry, there's nothing at this address.</p>
10+
</LayoutView>
11+
</NotFound>
12+
</Router>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.11" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.11" PrivateAssets="all" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\..\src\Exceptionless\Exceptionless.csproj" />
16+
</ItemGroup>
17+
18+
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@page "/counter"
2+
3+
<PageTitle>Counter</PageTitle>
4+
5+
<h1>Counter</h1>
6+
7+
<p role="status">Current count: @currentCount</p>
8+
9+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
10+
11+
@code {
12+
private int currentCount = 0;
13+
14+
private void IncrementCount()
15+
{
16+
try
17+
{
18+
throw new Exception("I am throwing an exception. This needs to be sent to Exceptionless...");
19+
}
20+
catch (Exception ex)
21+
{
22+
ex.ToExceptionless().Submit();
23+
}
24+
25+
currentCount++;
26+
}
27+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
@page "/fetchdata"
2+
@inject HttpClient Http
3+
4+
<PageTitle>Weather forecast</PageTitle>
5+
6+
<h1>Weather forecast</h1>
7+
8+
<p>This component demonstrates fetching data from the server.</p>
9+
10+
@if (forecasts == null)
11+
{
12+
<p><em>Loading...</em></p>
13+
}
14+
else
15+
{
16+
<table class="table">
17+
<thead>
18+
<tr>
19+
<th>Date</th>
20+
<th>Temp. (C)</th>
21+
<th>Temp. (F)</th>
22+
<th>Summary</th>
23+
</tr>
24+
</thead>
25+
<tbody>
26+
@foreach (var forecast in forecasts)
27+
{
28+
<tr>
29+
<td>@forecast.Date.ToShortDateString()</td>
30+
<td>@forecast.TemperatureC</td>
31+
<td>@forecast.TemperatureF</td>
32+
<td>@forecast.Summary</td>
33+
</tr>
34+
}
35+
</tbody>
36+
</table>
37+
}
38+
39+
@code {
40+
private WeatherForecast[]? forecasts;
41+
42+
protected override async Task OnInitializedAsync()
43+
{
44+
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
45+
}
46+
47+
public class WeatherForecast
48+
{
49+
public DateTime Date { get; set; }
50+
51+
public int TemperatureC { get; set; }
52+
53+
public string? Summary { get; set; }
54+
55+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
56+
}
57+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@page "/"
2+
3+
<PageTitle>Index</PageTitle>
4+
5+
<h1>Hello, world!</h1>
6+
7+
Welcome to your new app.
8+
9+
<SurveyPrompt Title="How is Blazor working for you?" />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Exceptionless;
2+
using Exceptionless.SampleBlazorWebAssemblyApp;
3+
using Microsoft.AspNetCore.Components.Web;
4+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
5+
6+
ExceptionlessClient.Default.Configuration.ServerUrl = "http://localhost:5000";
7+
ExceptionlessClient.Default.Startup("LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw");
8+
9+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
10+
builder.RootComponents.Add<App>("#app");
11+
builder.RootComponents.Add<HeadOutlet>("head::after");
12+
13+
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
14+
15+
await builder.Build().RunAsync();
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:14745",
7+
"sslPort": 44336
8+
}
9+
},
10+
"profiles": {
11+
"Exceptionless.SampleBlazorWebAssemblyApp": {
12+
"commandName": "Project",
13+
"dotnetRunMessages": true,
14+
"launchBrowser": true,
15+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
16+
"applicationUrl": "https://localhost:7255;http://localhost:5106",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
},
21+
"IIS Express": {
22+
"commandName": "IISExpress",
23+
"launchBrowser": true,
24+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
25+
"environmentVariables": {
26+
"ASPNETCORE_ENVIRONMENT": "Development"
27+
}
28+
}
29+
}
30+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu />
6+
</div>
7+
8+
<main>
9+
<div class="top-row px-4">
10+
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
11+
</div>
12+
13+
<article class="content px-4">
14+
@Body
15+
</article>
16+
</main>
17+
</div>
Lines changed: 81 additions & 0 deletions
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)