From 9f5c97d52fd0cdde246af6e84fc7aee87ee98d96 Mon Sep 17 00:00:00 2001 From: punker76 Date: Sat, 2 Dec 2023 00:09:26 +0100 Subject: [PATCH 1/3] feat: Replacing .NET versions --- appveyor.yml | 15 ++---- src/Directory.Build.Props | 52 +++++++++++++++++-- src/Directory.Build.Targets | 14 ----- src/Directory.packages.props | 23 ++++---- src/MahApps.Metro/Directory.Build.Targets | 39 -------------- src/MahApps.Metro/Directory.Build.props | 24 --------- src/MahApps.Metro/MahApps.Metro.csproj | 26 +++++++++- src/MahApps.Metro/MahAppsException.cs | 18 ++++++- .../Tests/MathConverterTests.cs | 27 +++++----- .../Tests/NumericUpDownTests.cs | 10 ++-- src/global.json | 4 +- 11 files changed, 124 insertions(+), 128 deletions(-) delete mode 100644 src/MahApps.Metro/Directory.Build.Targets delete mode 100644 src/MahApps.Metro/Directory.Build.props diff --git a/appveyor.yml b/appveyor.yml index 4610d050ef..9f20981bca 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,7 +19,7 @@ environment: skip_tags: true image: Visual Studio 2022 -test: off +test: false install: # Appveyor uses git checkout -qf FETCH_HEAD but all GitVersion versions above 5.6.3 doesn't support this detached header @@ -29,14 +29,14 @@ install: { git checkout -qf $($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) } - # - ps: Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1' - # - ps: ./dotnet-install.ps1 -Version 6.0.100 -InstallDir "C:\Program Files\dotnet" + - ps: Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1' + - ps: ./dotnet-install.ps1 -Version 8.0.100 -InstallDir "C:\Program Files\dotnet" pull_requests: do_not_increment_build_number: false build_script: - - ps: dotnet --list-sdks + - ps: dotnet --info - ps: gitversion /version - ps: .\build.ps1 --target=ci #--verbosity=diagnostic @@ -52,10 +52,3 @@ nuget: skip_commits: files: - '**/*.md' - -# notifications: -# - provider: Webhook -# url: https://webhooks.gitter.im/e/3065442a8d5860a11008 -# on_build_success: true -# on_build_failure: true -# on_build_status_changed: false diff --git a/src/Directory.Build.Props b/src/Directory.Build.Props index eb48b4a355..3d21ad28c5 100644 --- a/src/Directory.Build.Props +++ b/src/Directory.Build.Props @@ -7,16 +7,60 @@ - net462;net47;net48;net5.0-windows;net6.0-windows + net8.0-windows;net6.0-windows;net462 + latestmajor + true false + Release true - latestmajor + + true + enable + $(NoWarn);CS1591 $(NoError);CS1591 - true true - enable + + + + + true + + MahApps + MahApps.Metro + Copyright © $([System.DateTime]::Today.ToString(yyyy)) .NET Foundation and Contributors. All rights reserved. + MahApps.Metro, a toolkit for creating Metro / Modern UI styled WPF applications. + + 3.0.0.0 + 3.0.0.0 + 3.0.0.0 + SRC + + + + + True + $(MSBuildThisFileDirectory)/mahapps.public.snk + false + true + + + + + + true + + true + + + true + + + + + true + Embedded diff --git a/src/Directory.Build.Targets b/src/Directory.Build.Targets index 6bf6227e76..c87836563a 100644 --- a/src/Directory.Build.Targets +++ b/src/Directory.Build.Targets @@ -1,19 +1,5 @@ - - - MahApps - MahApps.Metro - Copyright © $([System.DateTime]::Today.ToString(yyyy)) .NET Foundation and Contributors. All rights reserved. - MahApps.Metro, a toolkit for creating Metro / Modern UI styled WPF applications. - - true - 3.0.0.0 - 3.0.0.0 - 3.0.0.0 - 3.0.0.0 - - diff --git a/src/Directory.packages.props b/src/Directory.packages.props index f34fe11c1c..95c2a131dc 100644 --- a/src/Directory.packages.props +++ b/src/Directory.packages.props @@ -9,8 +9,9 @@ + + - @@ -23,22 +24,20 @@ - - + + - - - - + + - - - - - + + + + + \ No newline at end of file diff --git a/src/MahApps.Metro/Directory.Build.Targets b/src/MahApps.Metro/Directory.Build.Targets deleted file mode 100644 index 17f1b53d30..0000000000 --- a/src/MahApps.Metro/Directory.Build.Targets +++ /dev/null @@ -1,39 +0,0 @@ - - - - - True - - - - - - - Jan Karger, Bastian Schmidt, Dennis Daume, Brendan Forster, Alex Mitchell, Paul Jenkins, Jake Ginnivan - MIT - https://github.com/MahApps/MahApps.Metro - mahapps.metro.logo.png - WPF;UI;Metro;Modern;Material;XAML;Toolkit;Library;.NET;OSS;OpenSource - https://github.com/MahApps/MahApps.Metro/releases - https://github.com/MahApps/MahApps.Metro.git - git - true - - - - $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) - - - - - - - - True - $(MSBuildProjectDirectory)\..\mahapps.public.snk - false - true - - - - \ No newline at end of file diff --git a/src/MahApps.Metro/Directory.Build.props b/src/MahApps.Metro/Directory.Build.props deleted file mode 100644 index 50734e48d1..0000000000 --- a/src/MahApps.Metro/Directory.Build.props +++ /dev/null @@ -1,24 +0,0 @@ - - - - - true - - true - - - true - - - - - true - Embedded - - - - - - - - \ No newline at end of file diff --git a/src/MahApps.Metro/MahApps.Metro.csproj b/src/MahApps.Metro/MahApps.Metro.csproj index 6b8fdd88b2..a7b9cd1ed7 100644 --- a/src/MahApps.Metro/MahApps.Metro.csproj +++ b/src/MahApps.Metro/MahApps.Metro.csproj @@ -9,6 +9,23 @@ $(DefineConstants);INTERNAL_NULLABLE_ATTRIBUTES + + + Jan Karger, Bastian Schmidt, Dennis Daume, Brendan Forster, Alex Mitchell, Paul Jenkins, Jake Ginnivan + MIT + https://github.com/MahApps/MahApps.Metro + mahapps.metro.logo.png + WPF;UI;Metro;Modern;Material;XAML;Toolkit;Library;.NET;OSS;OpenSource + https://github.com/MahApps/MahApps.Metro/releases + https://github.com/MahApps/MahApps.Metro.git + git + true + + + + + + @@ -24,6 +41,13 @@ + + + True + + + + @@ -57,4 +81,4 @@ - + \ No newline at end of file diff --git a/src/MahApps.Metro/MahAppsException.cs b/src/MahApps.Metro/MahAppsException.cs index b5ce30b740..c3418f5cf2 100644 --- a/src/MahApps.Metro/MahAppsException.cs +++ b/src/MahApps.Metro/MahAppsException.cs @@ -3,12 +3,18 @@ // See the LICENSE file in the project root for more information. using System; -using System.Runtime.Serialization; using System.Windows; +#if !NET8_0_OR_GREATER +using System.Runtime.Serialization; +using System.Security; +#endif + namespace MahApps.Metro { +#if !NET8_0_OR_GREATER [Serializable] +#endif public class MahAppsException : Exception { public MahAppsException() @@ -25,23 +31,31 @@ public MahAppsException(string message, Exception? innerException) { } +#if !NET8_0_OR_GREATER + [SecuritySafeCritical] protected MahAppsException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif } +#if !NET8_0_OR_GREATER [Serializable] +#endif public class MissingRequiredTemplatePartException : MahAppsException { public MissingRequiredTemplatePartException(FrameworkElement target, string templatePart) : base($"Template part \"{templatePart}\" in template for \"{target.GetType().FullName}\" is missing.") { } - + +#if !NET8_0_OR_GREATER + [SecuritySafeCritical] protected MissingRequiredTemplatePartException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif } } \ No newline at end of file diff --git a/src/Mahapps.Metro.Tests/Tests/MathConverterTests.cs b/src/Mahapps.Metro.Tests/Tests/MathConverterTests.cs index bea83146e0..8e009fc554 100644 --- a/src/Mahapps.Metro.Tests/Tests/MathConverterTests.cs +++ b/src/Mahapps.Metro.Tests/Tests/MathConverterTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Globalization; using System.Windows; using System.Windows.Data; @@ -23,9 +22,9 @@ public class MathConverterTests [InlineData(10d, 32d, 42d)] [InlineData(10.5d, 31.5d, 42d)] [InlineData(52, -10, 42d)] - public void MathAddConverter_should_add_values(object value1, object value2, object expectedValue) + public void MathAddConverter_should_add_values(object value, object parameter, object expectedValue) { - Assert.Equal(expectedValue, this.mathAddConverter.Convert(value1, null, value2, CultureInfo.InvariantCulture)); + Assert.Equal(expectedValue, this.mathAddConverter.Convert(value, typeof(object), parameter, CultureInfo.InvariantCulture)); } [Theory] @@ -33,9 +32,9 @@ public void MathAddConverter_should_add_values(object value1, object value2, obj [InlineData(52d, 10d, 42d)] [InlineData(52.5d, 10.5d, 42d)] [InlineData(-32, 10, -42d)] - public void MathSubtractConverter_should_substract_values(object value1, object value2, object expectedValue) + public void MathSubtractConverter_should_substract_values(object value, object parameter, object expectedValue) { - Assert.Equal(expectedValue, this.mathSubtractConverter.Convert(value1, null, value2, CultureInfo.InvariantCulture)); + Assert.Equal(expectedValue, this.mathSubtractConverter.Convert(value, typeof(object), parameter, CultureInfo.InvariantCulture)); } [Theory] @@ -43,9 +42,9 @@ public void MathSubtractConverter_should_substract_values(object value1, object [InlineData(7d, 6d, 42d)] [InlineData(0, 0, 0d)] [InlineData(42d, 0d, 0d)] - public void MathMultiplyConverter_should_multiply_values(object value1, object value2, object expectedValue) + public void MathMultiplyConverter_should_multiply_values(object value, object parameter, object expectedValue) { - Assert.Equal(expectedValue, this.mathMultiplyConverter.Convert(value1, null, value2, CultureInfo.InvariantCulture)); + Assert.Equal(expectedValue, this.mathMultiplyConverter.Convert(value, typeof(object), parameter, CultureInfo.InvariantCulture)); } [Theory] @@ -54,9 +53,9 @@ public void MathMultiplyConverter_should_multiply_values(object value1, object v [InlineData(0, 10, 0d)] [InlineData(42d, 0d, null)] [InlineData(42d, 0, null)] - public void MathDivideConverter_should_multiply_values(object value1, object value2, object expectedValue) + public void MathDivideConverter_should_multiply_values(object value, object parameter, object? expectedValue) { - Assert.Equal(expectedValue ?? Binding.DoNothing, this.mathDivideConverter.Convert(value1, null, value2, CultureInfo.InvariantCulture)); + Assert.Equal(expectedValue ?? Binding.DoNothing, this.mathDivideConverter.Convert(value, typeof(object), parameter, CultureInfo.InvariantCulture)); } [Theory] @@ -64,12 +63,12 @@ public void MathDivideConverter_should_multiply_values(object value1, object val [InlineData(10d, 32d)] [InlineData(10.5d, 31.5d)] [InlineData(52, -10)] - public void MathConverter_should_not_convert_back(object value1, object value2) + public void MathConverter_should_not_convert_back(object value, object parameter) { - Assert.Equal(DependencyProperty.UnsetValue, this.mathAddConverter.ConvertBack(value1, (Type)null, value2, CultureInfo.InvariantCulture)); - Assert.Equal(DependencyProperty.UnsetValue, this.mathSubtractConverter.ConvertBack(value1, (Type)null, value2, CultureInfo.InvariantCulture)); - Assert.Equal(DependencyProperty.UnsetValue, this.mathMultiplyConverter.ConvertBack(value1, (Type)null, value2, CultureInfo.InvariantCulture)); - Assert.Equal(DependencyProperty.UnsetValue, this.mathDivideConverter.ConvertBack(value1, (Type)null, value2, CultureInfo.InvariantCulture)); + Assert.Equal(DependencyProperty.UnsetValue, this.mathAddConverter.ConvertBack(value, typeof(object), parameter, CultureInfo.InvariantCulture)); + Assert.Equal(DependencyProperty.UnsetValue, this.mathSubtractConverter.ConvertBack(value, typeof(object), parameter, CultureInfo.InvariantCulture)); + Assert.Equal(DependencyProperty.UnsetValue, this.mathMultiplyConverter.ConvertBack(value, typeof(object), parameter, CultureInfo.InvariantCulture)); + Assert.Equal(DependencyProperty.UnsetValue, this.mathDivideConverter.ConvertBack(value, typeof(object), parameter, CultureInfo.InvariantCulture)); } } } \ No newline at end of file diff --git a/src/Mahapps.Metro.Tests/Tests/NumericUpDownTests.cs b/src/Mahapps.Metro.Tests/Tests/NumericUpDownTests.cs index 89cb046d15..b94bbdea68 100644 --- a/src/Mahapps.Metro.Tests/Tests/NumericUpDownTests.cs +++ b/src/Mahapps.Metro.Tests/Tests/NumericUpDownTests.cs @@ -98,7 +98,7 @@ public async Task ShouldSnapToMultipleOfInterval() [InlineData(255d, "x4", "00ff")] [InlineData(-1d, "X4", "FFFFFFFF")] [DisplayTestMethodName] - public async Task ShouldFormatValueInput(object value, string format, string expectedText) + public async Task ShouldFormatValueInput(object? value, string format, string expectedText) { await this.fixture.PrepareForTestAsync(); await TestHost.SwitchToAppThread(); @@ -142,7 +142,7 @@ public async Task ShouldFormatValueInput(object value, string format, string exp [InlineData(".9", NumericInput.Numbers, 9d)] [InlineData("", NumericInput.Numbers, null)] [DisplayTestMethodName] - public async Task ShouldConvertManualTextInput(string text, NumericInput numericInput, object expectedValue) + public async Task ShouldConvertManualTextInput(string text, NumericInput numericInput, object? expectedValue) { await this.fixture.PrepareForTestAsync(); await TestHost.SwitchToAppThread(); @@ -175,7 +175,7 @@ public async Task ShouldConvertManualTextInput(string text, NumericInput numeric [InlineData("0.986", "{}{0:G3} mPa·s", 0.986d, "0.986 mPa·s")] // GH-3376#issuecomment-472324787 [InlineData("", "{}{0:N2} cm", null, "")] [DisplayTestMethodName] - public async Task ShouldConvertTextInputWithStringFormat(string text, string format, object expectedValue, string expectedText) + public async Task ShouldConvertTextInputWithStringFormat(string text, string format, object? expectedValue, string expectedText) { await this.fixture.PrepareForTestAsync(); await TestHost.SwitchToAppThread(); @@ -213,7 +213,7 @@ public async Task ShouldConvertTextInputWithStringFormat(string text, string for [InlineData("100%", "{}{0}%", null, 100d, "100%", false)] [InlineData("100 %", "{}{0}%", null, 100d, "100%", false)] [DisplayTestMethodName] - public async Task ShouldConvertTextInputWithPercentageStringFormat(string text, string format, string culture, object expectedValue, string expectedText, bool useEpsilon) + public async Task ShouldConvertTextInputWithPercentageStringFormat(string text, string format, string? culture, object expectedValue, string expectedText, bool useEpsilon) { await this.fixture.PrepareForTestAsync(); await TestHost.SwitchToAppThread(); @@ -262,7 +262,7 @@ public async Task ShouldConvertTextInputWithPercentageStringFormat(string text, [InlineData("1 ‰", "0.0‰", "en-EN", 0.001d, "1.0‰")] [InlineData("0.25", "{0:0.0000}‰", null, 0.25d, "0.2500‰")] [DisplayTestMethodName] - public async Task ShouldConvertTextInputWithPermilleStringFormat(string text, string format, string culture, object expectedValue, string expectedText) + public async Task ShouldConvertTextInputWithPermilleStringFormat(string text, string format, string? culture, object expectedValue, string expectedText) { await this.fixture.PrepareForTestAsync(); await TestHost.SwitchToAppThread(); diff --git a/src/global.json b/src/global.json index 28288bd53b..81e632ac38 100644 --- a/src/global.json +++ b/src/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "6.0.400", - "rollForward": "latestFeature", + "version": "8.0.100", + "rollForward": "feature", "allowPrerelease": false } } \ No newline at end of file From 51979ca53086c1aa34d2b00323f1fa5c2a615c9e Mon Sep 17 00:00:00 2001 From: punker76 Date: Sat, 2 Dec 2023 00:16:26 +0100 Subject: [PATCH 2/3] ci: support dotnet 8 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 987679c6d8..96ff85ae3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,10 +20,10 @@ jobs: uses: actions/setup-dotnet@v1 with: dotnet-version: | - 5.x 6.x + 8.x - name: List dotnet sdks - run: dotnet --list-sdks + run: dotnet --info - name: Run the Cake script uses: cake-build/cake-action@v1 with: From 234788b391af0b88cc8ca718d1a1933f83ca132f Mon Sep 17 00:00:00 2001 From: punker76 Date: Fri, 8 Dec 2023 22:20:44 +0100 Subject: [PATCH 3/3] chore: use next ControlzEx v7 --- src/Directory.packages.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Directory.packages.props b/src/Directory.packages.props index 95c2a131dc..8df5d46dca 100644 --- a/src/Directory.packages.props +++ b/src/Directory.packages.props @@ -5,8 +5,8 @@ - - + +