From 6665a3ae94262b6244f44fa45e4cd6ece55ee1e8 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 26 Oct 2023 15:57:35 +0600 Subject: [PATCH 1/7] Add support for runtimes without built-in COM interop --- ICSharpCode.AvalonEdit/Editing/ImeNativeWrapper.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.AvalonEdit/Editing/ImeNativeWrapper.cs b/ICSharpCode.AvalonEdit/Editing/ImeNativeWrapper.cs index b7033c4c..3e468087 100644 --- a/ICSharpCode.AvalonEdit/Editing/ImeNativeWrapper.cs +++ b/ICSharpCode.AvalonEdit/Editing/ImeNativeWrapper.cs @@ -116,7 +116,14 @@ public static ITfThreadMgr GetTextFrameworkThreadManager() { if (!textFrameworkThreadMgrInitialized) { textFrameworkThreadMgrInitialized = true; - TF_CreateThreadMgr(out textFrameworkThreadMgr); + try + { + TF_CreateThreadMgr(out textFrameworkThreadMgr); + } + catch + { + // The call will fail if the current runtime doesn't have COM interop + } } return textFrameworkThreadMgr; } From 35b52a893604fa8e13ca06175454028a61027dca Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Wed, 22 Nov 2023 07:16:41 +0100 Subject: [PATCH 2/7] Replace net7 target with net8 target --- .../ICSharpCode.AvalonEdit.Sample.csproj | 4 ++-- .../ICSharpCode.AvalonEdit.Tests.csproj | 4 ++-- ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj | 4 ++-- global.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ICSharpCode.AvalonEdit.Sample/ICSharpCode.AvalonEdit.Sample.csproj b/ICSharpCode.AvalonEdit.Sample/ICSharpCode.AvalonEdit.Sample.csproj index f9c72545..513fefb4 100644 --- a/ICSharpCode.AvalonEdit.Sample/ICSharpCode.AvalonEdit.Sample.csproj +++ b/ICSharpCode.AvalonEdit.Sample/ICSharpCode.AvalonEdit.Sample.csproj @@ -1,7 +1,7 @@  WinExe - net6.0-windows;net7.0-windows;net472 + net6.0-windows;net8.0-windows;net472 true true TRACE @@ -17,7 +17,7 @@ TRACE - + TRACE diff --git a/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj b/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj index 97fff5db..6f154c49 100644 --- a/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj +++ b/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj @@ -1,7 +1,7 @@  Library - net6.0-windows;net7.0-windows;net462 + net6.0-windows;net8.0-windows;net462 true true TRACE @@ -16,7 +16,7 @@ TRACE - + TRACE diff --git a/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj b/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj index 18f55820..bb14a530 100644 --- a/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj +++ b/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj @@ -1,7 +1,7 @@  Library - net6.0-windows;net7.0-windows;net462 + net6.0-windows;net8.0-windows;net462 true true TRACE @@ -43,7 +43,7 @@ TRACE - + TRACE diff --git a/global.json b/global.json index 1fcfe4fe..6a5d4bad 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100", + "version": "8.0.100", "rollForward": "major", "allowPrerelease": true } From 8cfb6abcc43d35e37f1e3dc496a460235d974ebe Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Wed, 22 Nov 2023 07:21:45 +0100 Subject: [PATCH 3/7] Non-LTS net70 SDK no longer needed in build pipeline --- .github/workflows/dotnet.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 75e2de7b..f292bb62 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -27,11 +27,6 @@ jobs: assemblyVersion: ${{ env.BuildVersion }}.${{ github.run_number }} fileVersion: ${{ env.BuildVersion }}.${{ github.run_number }} - - name: Setup .NET 7 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.0.x - - name: Setup LTS .NET uses: actions/setup-dotnet@v3 with: @@ -53,10 +48,10 @@ jobs: env: TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\net6.0-windows\ICSharpCode.AvalonEdit.Tests.dll - - name: net7.0-windows Unit Tests + - name: net8.0-windows Unit Tests run: vstest.console $env:TestAssembly env: - TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\net7.0-windows\ICSharpCode.AvalonEdit.Tests.dll + TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\net8.0-windows\ICSharpCode.AvalonEdit.Tests.dll - name: net462 Unit Tests run: vstest.console $env:TestAssembly From 26b3d0d6ebd40e871b33db44ff6ae9304019dac1 Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Wed, 22 Nov 2023 07:28:21 +0100 Subject: [PATCH 4/7] Add .NET 8 SDK --- .github/workflows/dotnet.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f292bb62..dce37fe6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -27,6 +27,11 @@ jobs: assemblyVersion: ${{ env.BuildVersion }}.${{ github.run_number }} fileVersion: ${{ env.BuildVersion }}.${{ github.run_number }} + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + - name: Setup LTS .NET uses: actions/setup-dotnet@v3 with: From 5564793e821fea4731092b72e69492de2f7f6e54 Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Wed, 22 Nov 2023 07:33:35 +0100 Subject: [PATCH 5/7] Fix warnings for exceptions --- ICSharpCode.AvalonEdit/Editing/DragDropException.cs | 3 ++- .../Highlighting/HighlightingDefinitionInvalidException.cs | 3 ++- .../Rendering/VisualLinesInvalidException.cs | 3 ++- ICSharpCode.AvalonEdit/Search/ISearchStrategy.cs | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ICSharpCode.AvalonEdit/Editing/DragDropException.cs b/ICSharpCode.AvalonEdit/Editing/DragDropException.cs index c3417887..1b6d28bc 100644 --- a/ICSharpCode.AvalonEdit/Editing/DragDropException.cs +++ b/ICSharpCode.AvalonEdit/Editing/DragDropException.cs @@ -50,12 +50,13 @@ public DragDropException(string message) : base(message) public DragDropException(string message, Exception innerException) : base(message, innerException) { } - +#if !NET6_0_OR_GREATER /// /// Deserializes a DragDropException. /// protected DragDropException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif } } diff --git a/ICSharpCode.AvalonEdit/Highlighting/HighlightingDefinitionInvalidException.cs b/ICSharpCode.AvalonEdit/Highlighting/HighlightingDefinitionInvalidException.cs index 2cb3679a..c05b3415 100644 --- a/ICSharpCode.AvalonEdit/Highlighting/HighlightingDefinitionInvalidException.cs +++ b/ICSharpCode.AvalonEdit/Highlighting/HighlightingDefinitionInvalidException.cs @@ -47,12 +47,13 @@ public HighlightingDefinitionInvalidException(string message) : base(message) public HighlightingDefinitionInvalidException(string message, Exception innerException) : base(message, innerException) { } - +#if !NET6_0_OR_GREATER /// /// Creates a new HighlightingDefinitionInvalidException instance. /// protected HighlightingDefinitionInvalidException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif } } diff --git a/ICSharpCode.AvalonEdit/Rendering/VisualLinesInvalidException.cs b/ICSharpCode.AvalonEdit/Rendering/VisualLinesInvalidException.cs index 79b85cb8..add5db6b 100644 --- a/ICSharpCode.AvalonEdit/Rendering/VisualLinesInvalidException.cs +++ b/ICSharpCode.AvalonEdit/Rendering/VisualLinesInvalidException.cs @@ -48,12 +48,13 @@ public VisualLinesInvalidException(string message) : base(message) public VisualLinesInvalidException(string message, Exception innerException) : base(message, innerException) { } - +#if !NET6_0_OR_GREATER /// /// Creates a new VisualLinesInvalidException instance. /// protected VisualLinesInvalidException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif } } diff --git a/ICSharpCode.AvalonEdit/Search/ISearchStrategy.cs b/ICSharpCode.AvalonEdit/Search/ISearchStrategy.cs index 74bea578..05f31fd5 100644 --- a/ICSharpCode.AvalonEdit/Search/ISearchStrategy.cs +++ b/ICSharpCode.AvalonEdit/Search/ISearchStrategy.cs @@ -93,11 +93,12 @@ public SearchPatternException(string message) : base(message) public SearchPatternException(string message, Exception innerException) : base(message, innerException) { } - +#if !NET6_0_OR_GREATER // This constructor is needed for serialization. /// protected SearchPatternException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif } } From 3ce74e9bc8ff007fed84f3fecf59d06d626912dc Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Wed, 22 Nov 2023 07:34:56 +0100 Subject: [PATCH 6/7] Update NuGet packages for .Test project --- .../ICSharpCode.AvalonEdit.Tests.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj b/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj index 6f154c49..4a7ccf17 100644 --- a/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj +++ b/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj @@ -24,10 +24,10 @@ - - - - + + + + From 30cad99ce905412ed5f5e847e3c00e72e69aee77 Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Wed, 22 Nov 2023 10:54:24 +0100 Subject: [PATCH 7/7] Exclude multi-threaded test for net80 --- .../MultipleUIThreads.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs b/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs index 92613b04..df79ac91 100644 --- a/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs +++ b/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs @@ -19,6 +19,7 @@ using System; using System.Threading; using System.Windows; + using NUnit.Framework; namespace ICSharpCode.AvalonEdit @@ -27,7 +28,21 @@ namespace ICSharpCode.AvalonEdit public class MultipleUIThreads { Exception error; - + + /* NET80 error on GH CI: + The active test run was aborted. Reason: Test host process crashed : Process terminated. Encountered infinite recursion while looking up resource 'Arg_NullReferenceException' in System.Private.CoreLib. Verify the installation of .NET is complete and does not need repairing, and that the state of the process has not become corrupted. + at System.Environment.FailFast(System.String) + at System.SR.InternalGetResourceString(System.String) + at System.SR.GetResourceString(System.String) + at System.NullReferenceException..ctor() + at System.Resources.ResourceManager.GetString(System.String, System.Globalization.CultureInfo) + at System.SR.InternalGetResourceString(System.String) + at System.SR.GetResourceString(System.String) + at System.NullReferenceException..ctor() + at System.Threading.Thread.get_CurrentThread() + at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) + */ +#if !NET8_0_OR_GREATER [Test] public void CreateEditorInstancesOnMultipleUIThreads() { @@ -42,7 +57,7 @@ public void CreateEditorInstancesOnMultipleUIThreads() if (error != null) throw new InvalidOperationException(error.Message, error); } - +#endif [STAThread] void Run() {