Skip to content

Commit 5e87bbf

Browse files
authored
Breaking changes for .net9 (#120)
* DOTNET_SYSTEM_GLOBALIZATION_INVARIANT is now set to 0 by default, as there are multiple scenarios that no longer work with "1" (ex simple code like int.Parse) * Fix JsDirect problem for with overload confusion when optimizing * Remove obsolete methods * Major version upgrade * Update Serialize.Linq dep
1 parent dcb68f6 commit 5e87bbf

File tree

17 files changed

+140
-246
lines changed

17 files changed

+140
-246
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* binary

src/BlazorWorker.Demo/Net9/BLazorWorker.Demo.Client/wwwroot/.nojekyll

Whitespace-only changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>BlazorFileReader</title>
6+
<script type="text/javascript">
7+
// Single Page Apps for GitHub Pages
8+
// https://github.com/rafrex/spa-github-pages
9+
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License
10+
// ----------------------------------------------------------------------
11+
// This script takes the current url and converts the path and query
12+
// string into just a query string, and then redirects the browser
13+
// to the new url with only a query string and hash fragment,
14+
// e.g. http://www.foo.tld/one/two?a=b&c=d#qwe, becomes
15+
// http://www.foo.tld/?p=/one/two&q=a=b~and~c=d#qwe
16+
// Note: this 404.html file must be at least 512 bytes for it to work
17+
// with Internet Explorer (it is currently > 512 bytes)
18+
19+
// If you're creating a Project Pages site and NOT using a custom domain,
20+
// then set segmentCount to 1 (enterprise users may need to set it to > 1).
21+
// This way the code will only replace the route part of the path, and not
22+
// the real directory in which the app resides, for example:
23+
// https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes
24+
// https://username.github.io/repo-name/?p=/one/two&q=a=b~and~c=d#qwe
25+
// Otherwise, leave segmentCount as 0.
26+
var segmentCount = 1;
27+
28+
var l = window.location;
29+
l.replace(
30+
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
31+
l.pathname.split('/').slice(0, 1 + segmentCount).join('/') + '/?p=/' +
32+
l.pathname.slice(1).split('/').slice(segmentCount).join('/').replace(/&/g, '~and~') +
33+
(l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
34+
l.hash
35+
);
36+
37+
</script>
38+
</head>
39+
<body>
40+
</body>
41+
</html>
Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
3-
4-
<head>
5-
<meta charset="utf-8" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>BlazorWorker.Demo.Client</title>
8-
<base href="/" />
9-
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
10-
<link rel="stylesheet" href="css/app.css" />
11-
<link rel="icon" type="image/png" href="favicon.png" />
12-
<link href="BlazorWorker.Demo.Client.styles.css" rel="stylesheet" />
13-
</head>
14-
15-
<body>
16-
<div id="app">
17-
<svg class="loading-progress">
18-
<circle r="40%" cx="50%" cy="50%" />
19-
<circle r="40%" cx="50%" cy="50%" />
20-
</svg>
21-
<div class="loading-progress-text"></div>
22-
</div>
23-
24-
<div id="blazor-error-ui">
25-
An unhandled error has occurred.
26-
<a href="." class="reload">Reload</a>
27-
<span class="dismiss">🗙</span>
28-
</div>
29-
<script src="_framework/blazor.webassembly.js"></script>
30-
<script src="_content/TG.Blazor.IndexedDB/indexedDb.Blazor.js"></script>
31-
<script>
32-
window.addEventListener('DOMContentLoaded', () => {
33-
const app = document.getElementById('app');
34-
const svg = app.querySelector('.loading-progress');
35-
36-
if (!svg) return;
37-
38-
// Get position and size of SVG
39-
const rect = svg.getBoundingClientRect();
40-
41-
// Create the image element
42-
const img = document.createElement('img');
43-
img.src = 'loading-icon.svg';
44-
img.width = 97;
45-
img.height = 88;
46-
img.style.position = 'absolute';
47-
img.style.left = rect.left + window.scrollX + rect.width / 2 - 97 / 2 + 'px';
48-
img.style.top = rect.top + window.scrollY + rect.height / 2 - 88 / 2 + 'px';
49-
img.style.pointerEvents = 'none';
50-
img.style.zIndex = '9999';
51-
52-
// Add it to the body
53-
document.getElementById("app").appendChild(img);
54-
});
55-
</script>
56-
</body>
57-
58-
</html>
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>BlazorWorker.Demo.Client</title>
8+
<base href="/" />
9+
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
10+
<link rel="stylesheet" href="css/app.css" />
11+
<link rel="icon" type="image/png" href="favicon.png" />
12+
<link href="BlazorWorker.Demo.Client.styles.css" rel="stylesheet" />
13+
</head>
14+
15+
<body>
16+
<div id="app">
17+
<svg class="loading-progress">
18+
<circle r="40%" cx="50%" cy="50%" />
19+
<circle r="40%" cx="50%" cy="50%" />
20+
</svg>
21+
<div class="loading-progress-text"></div>
22+
</div>
23+
24+
<div id="blazor-error-ui">
25+
An unhandled error has occurred.
26+
<a href="." class="reload">Reload</a>
27+
<span class="dismiss">🗙</span>
28+
</div>
29+
<script src="_framework/blazor.webassembly.js"></script>
30+
<script src="_content/TG.Blazor.IndexedDB/indexedDb.Blazor.js"></script>
31+
<script>
32+
window.addEventListener('DOMContentLoaded', () => {
33+
const app = document.getElementById('app');
34+
const svg = app.querySelector('.loading-progress');
35+
36+
if (!svg) return;
37+
38+
// Get position and size of SVG
39+
const rect = svg.getBoundingClientRect();
40+
41+
// Create the image element
42+
const img = document.createElement('img');
43+
img.src = 'loading-icon.svg';
44+
img.width = 97;
45+
img.height = 88;
46+
img.style.position = 'absolute';
47+
img.style.left = rect.left + window.scrollX + rect.width / 2 - 97 / 2 + 'px';
48+
img.style.top = rect.top + window.scrollY + rect.height / 2 - 88 / 2 + 'px';
49+
img.style.pointerEvents = 'none';
50+
img.style.zIndex = '9999';
51+
52+
// Add it to the body
53+
document.getElementById("app").appendChild(img);
54+
});
55+
</script>
56+
</body>
57+
58+
</html>

src/BlazorWorker.Demo/Net9/BLazorWorker.Demo.Client/wwwroot/sample-data/weather.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/BlazorWorker.Demo/Shared/JsInteractionsExample.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ public void Dispose()
119119
selfRef?.Dispose();
120120
}
121121

122+
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
122123
public async ValueTask DisposeAsync()
124+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
123125
{
124126
this.Dispose();
125127
}

src/BlazorWorker.Demo/SharedPages/Pages/IndexedDb.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@
110110
catch (Exception e)
111111
{
112112
output += $"{rn}Error = {e}";
113+
#pragma warning disable CS4014 // Call not awaited
113114
InvokeAsync(StateHasChanged);
115+
#pragma warning restore CS4014 // Call not awaited
114116
}
115117
finally
116118
{

src/BlazorWorker.ServiceFactory/BlazorWorker.BackgroundServiceFactory.csproj

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

33
<PropertyGroup>
4-
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
55
<PackageId>Tewr.BlazorWorker.BackgroundService</PackageId>
66
<PackageLicenseExpression>MIT</PackageLicenseExpression>
77
<Description>Use dotnet Web Workers Threads in Blazor</Description>
@@ -11,8 +11,8 @@
1111
<Authors>Tewr</Authors>
1212
<Product>BlazorWorker</Product>
1313
<Configurations>Debug;Release;Nuget</Configurations>
14-
<Version>4.1.2</Version>
15-
<AssemblyVersion>4.1.2.0</AssemblyVersion>
14+
<Version>5.0.0</Version>
15+
<AssemblyVersion>5.0.0</AssemblyVersion>
1616
<PackageIcon>icon.png</PackageIcon>
1717
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
1818
</PropertyGroup>
@@ -29,9 +29,13 @@
2929
<PackageReference Include="Microsoft.JSInterop" Version="8.0.0" />
3030
</ItemGroup>
3131

32+
<ItemGroup Condition="'$(TargetFramework)'=='net9.0'">
33+
<PackageReference Include="Microsoft.JSInterop" Version="9.0.7" />
34+
</ItemGroup>
35+
3236
<ItemGroup>
3337
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
34-
<PackageReference Include="Serialize.Linq" Version="3.0.152" />
38+
<PackageReference Include="Serialize.Linq" Version="4.0.167" />
3539
</ItemGroup>
3640

3741
<ItemGroup Condition="'$(Configuration)|$(Platform)'!='Nuget|AnyCPU'">
@@ -42,7 +46,7 @@
4246
</ItemGroup>
4347

4448
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Nuget|AnyCPU'">
45-
<PackageReference Include="Tewr.BlazorWorker.Core" Version="4.1.2" />
49+
<PackageReference Include="Tewr.BlazorWorker.Core" Version="5.0.0" />
4650
</ItemGroup>
4751

4852
<ItemGroup>

src/BlazorWorker.ServiceFactory/WorkerBackgroundServiceProxy.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,9 @@ public async Task InitAsync(WorkerInitOptions workerInitOptions = null)
119119
{
120120
this.initWorkerTask = new TaskCompletionSource<bool>();
121121

122-
if (workerInitOptions.UseConventionalServiceAssembly)
123-
{
124-
workerInitOptions.AddAssemblyOf<T>();
125-
}
126-
127-
await this.worker.InitAsync(new WorkerInitOptions {
128-
DependentAssemblyFilenames =
129-
WorkerBackgroundServiceDependencies.DependentAssemblyFilenames,
130-
InitEndPoint = WorkerBackgroundServiceProxy.InitEndPoint,
131-
//EndInvokeCallBackEndpoint = WorkerBackgroundServiceProxy.EndInvokeCallBackEndpoint
132-
}.MergeWith(workerInitOptions));
122+
await this.worker.InitAsync(new WorkerInitOptions {
123+
InitEndPoint = WorkerBackgroundServiceProxy.InitEndPoint,
124+
}.MergeWith(workerInitOptions));
133125

134126
this.worker.IncomingMessage += OnMessage;
135127

@@ -302,7 +294,7 @@ public async Task<TResult> RunAsync<TResult>(Expression<Func<T, TResult>> action
302294
return await InvokeAsyncInternal<TResult>(action);
303295
}
304296

305-
public async Task RunAsync<TResult>(Expression<Func<T, Task>> action)
297+
public async Task RunAsync(Expression<Func<T, Task>> action)
306298
{
307299
await InvokeAsyncInternal<object>(action, new InvokeOptions { AwaitResult = true });
308300
}
@@ -445,7 +437,7 @@ public async ValueTask DisposeAsync()
445437

446438
private class InvokeOptions
447439
{
448-
public static readonly InvokeOptions Default = new InvokeOptions();
440+
public static readonly InvokeOptions Default = new();
449441

450442
public bool AwaitResult { get; set; }
451443
}

src/BlazorWorker.WorkerBackgroundService/BlazorWorker.WorkerBackgroundService.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
55
<Nullable></Nullable>
66
<Configurations>Debug;Release;Nuget</Configurations>
7-
<Version>4.1.0</Version>
8-
<AssemblyVersion>4.1.0.0</AssemblyVersion>
7+
<Version>5.0.0</Version>
8+
<AssemblyVersion>5.0.0</AssemblyVersion>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1010
</PropertyGroup>
1111

@@ -36,7 +36,7 @@
3636
<ProjectReference Include="..\BlazorWorker.WorkerCore\BlazorWorker.WorkerCore.csproj" />
3737
</ItemGroup>
3838
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Nuget|AnyCPU'">
39-
<PackageReference Include="Tewr.BlazorWorker.Core" Version="4.0.0" />
39+
<PackageReference Include="Tewr.BlazorWorker.Core" Version="5.0.0" />
4040
</ItemGroup>
4141

4242
</Project>

0 commit comments

Comments
 (0)