Skip to content

Commit 960e7c1

Browse files
authored
Add .NET9 Support (MudBlazor#10233)
1 parent 30016e6 commit 960e7c1

37 files changed

+89
-56
lines changed

.vscode/launch.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"type": "blazorwasm",
1010
"request": "launch",
1111
"preLaunchTask": "build",
12-
"program": "${workspaceFolder}/src/MudBlazor.UnitTests.Viewer/bin/Debug/net8.0/MudBlazor.UnitTests.Viewer.dll",
12+
"program": "${workspaceFolder}/src/MudBlazor.UnitTests.Viewer/bin/Debug/net9.0/MudBlazor.UnitTests.Viewer.dll",
1313
"cwd": "${workspaceFolder}/src/MudBlazor.UnitTests.Viewer",
1414
"browser": "edge",
1515
"env": {
@@ -22,7 +22,7 @@
2222
"request": "launch",
2323
"preLaunchTask": "build",
2424
"hosted": true,
25-
"program": "${workspaceFolder}/src/MudBlazor.Docs.WasmHost/bin/Debug/net8.0/MudBlazor.Docs.WasmHost.dll",
25+
"program": "${workspaceFolder}/src/MudBlazor.Docs.WasmHost/bin/Debug/net9.0/MudBlazor.Docs.WasmHost.dll",
2626
"cwd": "${workspaceFolder}/src/MudBlazor.Docs.WasmHost",
2727
"browser": "edge",
2828
"env": {
@@ -34,7 +34,7 @@
3434
"type": "blazorwasm",
3535
"request": "launch",
3636
"preLaunchTask": "build",
37-
"program": "${workspaceFolder}/src/MudBlazor.Docs.Wasm/bin/Debug/net8.0/MudBlazor.Docs.Wasm.dll",
37+
"program": "${workspaceFolder}/src/MudBlazor.Docs.Wasm/bin/Debug/net9.0/MudBlazor.Docs.Wasm.dll",
3838
"cwd": "${workspaceFolder}/src/MudBlazor.Docs.Wasm",
3939
"browser": "edge",
4040
"env": {
@@ -46,7 +46,7 @@
4646
"type": "coreclr",
4747
"request": "launch",
4848
"preLaunchTask": "build",
49-
"program": "${workspaceFolder}/src/MudBlazor.Docs.Server/bin/Debug/net8.0/MudBlazor.Docs.Server.dll",
49+
"program": "${workspaceFolder}/src/MudBlazor.Docs.Server/bin/Debug/net9.0/MudBlazor.Docs.Server.dll",
5050
"cwd": "${workspaceFolder}/src/MudBlazor.Docs.Server",
5151
"stopAtEntry": false,
5252
"serverReadyAction": {

src/MudBlazor.Analyzers.TestComponents/MudBlazor.Analyzers.TestComponents.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<RootNamespace>MudBlazor.Analyzers.TestComponents</RootNamespace>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

src/MudBlazor.Docs.Compiler/MudBlazor.Docs.Compiler.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

src/MudBlazor.Docs.Server/MudBlazor.Docs.Server.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
</PropertyGroup>
77

src/MudBlazor.Docs.Wasm/MudBlazor.Docs.Wasm.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
77
</PropertyGroup>
@@ -11,9 +11,9 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
15-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
16-
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
14+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
15+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />
16+
<PackageReference Include="System.Net.Http.Json" Version="9.0.0" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

src/MudBlazor.Docs.WasmHost/MudBlazor.Docs.WasmHost.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<UserSecretsId>8b1bb13d-4e11-4924-b174-cf040d6576ea</UserSecretsId>
77
</PropertyGroup>
88

99
<ItemGroup>
1010
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
11-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.8" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

src/MudBlazor.Docs/MudBlazor.Docs.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Project Sdk="Microsoft.NET.Sdk.Razor">
44

55
<PropertyGroup>
6-
<TargetFramework>net8.0</TargetFramework>
6+
<TargetFramework>net9.0</TargetFramework>
77
</PropertyGroup>
88

99
<!--Outside Visual Studio SolutionDir is not available-->
@@ -20,7 +20,7 @@
2020

2121
<!--Project path for code generator-->
2222
<PropertyGroup>
23-
<BinDocsCompiler>$(SolutionDir)MudBlazor.Docs.Compiler/bin/Debug/net8.0/MudBlazor.Docs.Compiler.dll</BinDocsCompiler>
23+
<BinDocsCompiler>$(SolutionDir)MudBlazor.Docs.Compiler/bin/Debug/net9.0/MudBlazor.Docs.Compiler.dll</BinDocsCompiler>
2424
<ProjectDocsCompiler>dotnet run --configuration release --project "$(SolutionDir)MudBlazor.Docs.Compiler/MudBlazor.Docs.Compiler.csproj"</ProjectDocsCompiler>
2525
</PropertyGroup>
2626

@@ -86,9 +86,9 @@
8686
<PackageReference Include="BytexDigital.Blazor.Components.CookieConsent" Version="1.2.1" />
8787
<PackageReference Include="FluentValidation" Version="11.10.0" />
8888
<PackageReference Include="FuzzySharp" Version="2.0.2" />
89-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.8" />
90-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" />
91-
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="8.0.8" />
89+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.0" />
90+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0" />
91+
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="9.0.0" />
9292
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
9393
</ItemGroup>
9494

src/MudBlazor.Examples.Data/MudBlazor.Examples.Data.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
</PropertyGroup>
77

src/MudBlazor.UnitTests.Viewer/MudBlazor.UnitTests.Viewer.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<RootNamespace>MudBlazor.UnitTests</RootNamespace>
77
</PropertyGroup>
@@ -14,9 +14,9 @@
1414
<PropertyGroup Condition=" '$(RunConfiguration)' == 'MudBlazor.UnitTests.Viewer' " />
1515
<ItemGroup>
1616
<PackageReference Include="FluentValidation" Version="11.10.0" />
17-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
18-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
19-
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
17+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
18+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />
19+
<PackageReference Include="System.Net.Http.Json" Version="9.0.0" />
2020
</ItemGroup>
2121
<ItemGroup>
2222
<ProjectReference Include="..\MudBlazor.Examples.Data\MudBlazor.Examples.Data.csproj" />

src/MudBlazor.UnitTests/MudBlazor.UnitTests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</Target>
99

1010
<PropertyGroup>
11-
<TargetFramework>net8.0</TargetFramework>
11+
<TargetFramework>net9.0</TargetFramework>
1212
</PropertyGroup>
1313

1414
<ItemGroup>

src/MudBlazor/Components/DataGrid/Cell.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
// MudBlazor licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System.Diagnostics.CodeAnalysis;
56
using System.Text.Json;
67
using MudBlazor.Utilities;
78

89
namespace MudBlazor
910
{
1011
#nullable enable
11-
internal class Cell<T>
12+
internal class Cell<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>
1213
{
1314
private readonly MudDataGrid<T> _dataGrid;
1415
private readonly Column<T> _column;

src/MudBlazor/Components/DataGrid/CellContext.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
// MudBlazor licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System.Diagnostics.CodeAnalysis;
6+
57
namespace MudBlazor
68
{
79
#nullable enable
810
/// <summary>
911
/// Represents the current state of a cell in a <see cref="MudDataGrid{T}"/>.
1012
/// </summary>
1113
/// <typeparam name="T">The type of item displayed in the cell.</typeparam>
12-
public class CellContext<T>
14+
public class CellContext<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>
1315
{
1416
private readonly HashSet<T> _selection;
1517

src/MudBlazor/Components/DataGrid/Column.razor.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// MudBlazor licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System.Diagnostics.CodeAnalysis;
56
using System.Globalization;
67
using System.Linq.Expressions;
78
using Microsoft.AspNetCore.Components;
@@ -15,7 +16,7 @@ namespace MudBlazor
1516
/// Represents a vertical set of values.
1617
/// </summary>
1718
/// <typeparam name="T">The kind of item for this column.</typeparam>
18-
public abstract partial class Column<T> : MudComponentBase, IDisposable
19+
public abstract partial class Column<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T> : MudComponentBase, IDisposable
1920
{
2021
private static readonly RenderFragment<CellContext<T>> EmptyChildContent = _ => builder => { };
2122
internal ParameterState<bool> HiddenState { get; }

src/MudBlazor/Components/DataGrid/DataGridColumnResizeService.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
// MudBlazor licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System.Diagnostics.CodeAnalysis;
56
using Microsoft.AspNetCore.Components.Web;
67
using MudBlazor.Interfaces;
78

89
namespace MudBlazor
910
{
1011
#nullable enable
11-
internal sealed class DataGridColumnResizeService<T> : IAsyncDisposable
12+
internal sealed class DataGridColumnResizeService<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T> : IAsyncDisposable
1213
{
1314
private const string EventPointerMove = "pointermove";
1415
private const string EventPointerUp = "pointerup";

src/MudBlazor/Components/DataGrid/Definition/FilterDefinition.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
using System.Diagnostics.CodeAnalysis;
67

78
namespace MudBlazor
89
{
@@ -11,7 +12,7 @@ namespace MudBlazor
1112
/// Represents the logic of a filter applied to <see cref="MudGrid"/> data.
1213
/// </summary>
1314
/// <typeparam name="T">The type of object being filtered.</typeparam>
14-
public class FilterDefinition<T> : IFilterDefinition<T>
15+
public class FilterDefinition<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T> : IFilterDefinition<T>
1516
{
1617
private int _cachedExpressionHashCode;
1718
private Func<T, bool>? _cachedFilterFunction;

src/MudBlazor/Components/DataGrid/Definition/IFilterDefinition.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
using System.Diagnostics.CodeAnalysis;
67

78
namespace MudBlazor;
89

@@ -12,7 +13,7 @@ namespace MudBlazor;
1213
/// Defines filter definition features for a column.
1314
/// </summary>
1415
/// <typeparam name="T">The type of object being filtered.</typeparam>
15-
public interface IFilterDefinition<T>
16+
public interface IFilterDefinition<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>
1617
{
1718
/// <summary>
1819
/// The unique ID of this filter.

src/MudBlazor/Components/DataGrid/Filter.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
using System.Diagnostics.CodeAnalysis;
67
using System.Linq;
78
using System.Threading.Tasks;
89

910
namespace MudBlazor
1011
{
1112
#nullable enable
12-
internal class Filter<T>
13+
internal class Filter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>
1314
{
1415
private readonly MudDataGrid<T> _dataGrid;
1516
private readonly IFilterDefinition<T> _filterDefinition;

src/MudBlazor/Components/DataGrid/FilterContext.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using System.Collections.Generic;
7+
using System.Diagnostics.CodeAnalysis;
78
using System.Threading.Tasks;
89

910
namespace MudBlazor
@@ -13,7 +14,7 @@ namespace MudBlazor
1314
/// Represents the current state of a filter in a <see cref="MudDataGrid{T}"/>.
1415
/// </summary>
1516
/// <typeparam name="T">The type of item managed by the <see cref="MudDataGrid{T}"/>.</typeparam>
16-
public class FilterContext<T>
17+
public class FilterContext<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>
1718
{
1819
private readonly MudDataGrid<T> _dataGrid;
1920

src/MudBlazor/Components/DataGrid/FilterExpressionGenerator.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// MudBlazor licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44
using System;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Linq.Expressions;
67

78
namespace MudBlazor;
@@ -20,7 +21,7 @@ public static class FilterExpressionGenerator
2021
/// <param name="filter">The filter definition used to generate the expression.</param>
2122
/// <param name="filterOptions">Any options to apply such as case sensitivity.</param>
2223
/// <returns>An expression which can be executed to perform a filter.</returns>
23-
public static Expression<Func<T, bool>> GenerateExpression<T>(IFilterDefinition<T> filter, FilterOptions? filterOptions)
24+
public static Expression<Func<T, bool>> GenerateExpression<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(IFilterDefinition<T> filter, FilterOptions? filterOptions)
2425
{
2526
filterOptions ??= FilterOptions.Default; //Default if null
2627
var propertyExpression = filter.Column?.PropertyExpression;

src/MudBlazor/Components/DataGrid/FilterHeaderCell.razor.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
using System.Diagnostics.CodeAnalysis;
67
using System.Linq;
78
using System.Threading.Tasks;
89
using Microsoft.AspNetCore.Components;
@@ -16,7 +17,7 @@ namespace MudBlazor
1617
/// Represents a column filter shown when <see cref="MudDataGrid{T}.FilterMode"/> is <see cref="DataGridFilterMode.ColumnFilterRow"/>.
1718
/// </summary>
1819
/// <typeparam name="T">The type of value managed by the <see cref="MudDataGrid{T}"/></typeparam>
19-
public partial class FilterHeaderCell<T> : MudComponentBase
20+
public partial class FilterHeaderCell<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T> : MudComponentBase
2021
{
2122
/// <summary>
2223
/// The <see cref="MudDataGrid{T}"/> containing this filter cell.

src/MudBlazor/Components/DataGrid/FooterCell.razor.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// MudBlazor licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System.Diagnostics.CodeAnalysis;
56
using Microsoft.AspNetCore.Components;
67
using MudBlazor.Utilities;
78

@@ -11,7 +12,7 @@ namespace MudBlazor
1112
/// Represents a cell displayed at the bottom of a column.
1213
/// </summary>
1314
/// <typeparam name="T">The kind of data managed by this footer.</typeparam>
14-
public partial class FooterCell<T> : MudComponentBase
15+
public partial class FooterCell<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T> : MudComponentBase
1516
{
1617
/// <summary>
1718
/// The <see cref="MudDataGrid{T}"/> which contains this footer cell.

src/MudBlazor/Components/DataGrid/FooterContext.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using System.Collections.Generic;
7+
using System.Diagnostics.CodeAnalysis;
78
using System.Linq;
89
using System.Threading.Tasks;
910

@@ -15,7 +16,7 @@ namespace MudBlazor
1516
/// Represents the current state of a footer in a <see cref="MudDataGrid{T}"/>.
1617
/// </summary>
1718
/// <typeparam name="T">The kind of item being managed.</typeparam>
18-
public class FooterContext<T>
19+
public class FooterContext<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>
1920
{
2021
private readonly MudDataGrid<T> _dataGrid;
2122

0 commit comments

Comments
 (0)