From f9a370447fd18d1951faa0a901c77aa4c62a59e0 Mon Sep 17 00:00:00 2001 From: Matt Lyons Date: Thu, 15 Feb 2024 12:27:29 -0600 Subject: [PATCH] Update to .NET v8 and update our assembly dependencies (#765) --- README.md | 4 ++-- c-sharp-tests/PapiTestBase.cs | 2 ++ c-sharp-tests/Projects/LocalParatextProjectsTests.cs | 11 ++++++----- c-sharp-tests/Projects/ParatextDataProviderTests.cs | 7 +++++++ .../ParatextProjectStorageInterpreterTests.cs | 2 +- c-sharp-tests/c-sharp-tests.csproj | 12 ++++++------ c-sharp/MessageTransports/PapiClient.cs | 1 + c-sharp/ParanextDataProvider.csproj | 12 ++++++------ 8 files changed, 31 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 12da2f8097..bd1cdcb51a 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,9 @@ Add the system libraries needed for Electron, [Build Instructions (Linux)](https Install [`Node.js` version >=18.0.0](https://nodejs.org/) (18.0.0 or greater is required for using `fetch`). We recommend using [Volta](#javascript-tool-manager). -Install `dotnet` [.NET 7 SDK from here](https://learn.microsoft.com/en-us/dotnet/core/install/). +Install `dotnet` [.NET 8 SDK from here](https://learn.microsoft.com/en-us/dotnet/core/install/). -To check if `dotnet` is installed run (ensure you have a v7 SDK): +To check if `dotnet` is installed run (ensure you have a v8 SDK): ```bash dotnet --version diff --git a/c-sharp-tests/PapiTestBase.cs b/c-sharp-tests/PapiTestBase.cs index ff48de39b1..cc94f6a2ad 100644 --- a/c-sharp-tests/PapiTestBase.cs +++ b/c-sharp-tests/PapiTestBase.cs @@ -39,6 +39,8 @@ public virtual void TestTearDown() foreach (ScrText project in projects) ScrTextCollection.Remove(project, false); + + _client?.Dispose(); } #endregion diff --git a/c-sharp-tests/Projects/LocalParatextProjectsTests.cs b/c-sharp-tests/Projects/LocalParatextProjectsTests.cs index a21f1001c2..9ea2bebbbd 100644 --- a/c-sharp-tests/Projects/LocalParatextProjectsTests.cs +++ b/c-sharp-tests/Projects/LocalParatextProjectsTests.cs @@ -22,7 +22,8 @@ public void SetUp() [TearDown] public void TearDown() { - (_localProjects as IDisposable)?.Dispose(); + if (_localProjects is IDisposable disposable) + disposable.Dispose(); } #region Tests originally for now defunct DoesFolderMatchMetadata method @@ -46,7 +47,7 @@ public void Initialize_NonStandardFolderName_ProjectIsRetrievable(string folder) Assert.That(details, Is.EqualTo(_localProjects.GetProjectDetails(TEST_ID))); Assert.That(details.HomeDirectory, Does.EndWith(folder)); Assert.That(details.Metadata.Name, Is.EqualTo("ABC")); - Assert.True(details.Metadata.ID.Equals(TEST_ID, StringComparison.OrdinalIgnoreCase)); + Assert.That(details.Metadata.ID.Equals(TEST_ID, StringComparison.OrdinalIgnoreCase)); } [TestCase("ABC_441f1e41ffb8d319650847df35f4ffb78f12914e", "ABD")] @@ -61,7 +62,7 @@ public void Initialize_NameDoesNotMatch_ProjectIsRetrievable(string folder, stri Assert.That(details, Is.EqualTo(_localProjects.GetProjectDetails(TEST_ID))); Assert.That(details.HomeDirectory, Does.EndWith(folder)); Assert.That(details.Metadata.Name, Is.EqualTo(name)); - Assert.True(details.Metadata.ID.Equals(TEST_ID, StringComparison.OrdinalIgnoreCase)); + Assert.That(details.Metadata.ID.Equals(TEST_ID, StringComparison.OrdinalIgnoreCase)); } [TestCase("ABC_541f1e41ffb8d319650847df35f4ffb78f12914e", "ABC")] @@ -75,7 +76,7 @@ public void Initialize_IdDoesNotMatch_ProjectIsRetrievable(string folder, string Assert.That(details, Is.EqualTo(_localProjects.GetProjectDetails(TEST_ID))); Assert.That(details.HomeDirectory, Does.EndWith(folder)); Assert.That(details.Metadata.Name, Is.EqualTo(name)); - Assert.True(details.Metadata.ID.Equals(TEST_ID, StringComparison.OrdinalIgnoreCase)); + Assert.That(details.Metadata.ID.Equals(TEST_ID, StringComparison.OrdinalIgnoreCase)); } [TestCase("ABC_441F1E41FFB8D319650847DF35F4FFB78F12914E", "ABC")] @@ -91,7 +92,7 @@ public void Initialize_IdAndNameMatch_ProjectIsRetrievable(string folder, string Assert.That(details, Is.EqualTo(_localProjects.GetProjectDetails(TEST_ID))); Assert.That(details.HomeDirectory, Does.EndWith(folder)); Assert.That(details.Metadata.Name, Is.EqualTo(name)); - Assert.True(details.Metadata.ID.Equals(TEST_ID, StringComparison.OrdinalIgnoreCase)); + Assert.That(details.Metadata.ID.Equals(TEST_ID, StringComparison.OrdinalIgnoreCase)); } #endregion diff --git a/c-sharp-tests/Projects/ParatextDataProviderTests.cs b/c-sharp-tests/Projects/ParatextDataProviderTests.cs index 1957c23328..9e923dea03 100644 --- a/c-sharp-tests/Projects/ParatextDataProviderTests.cs +++ b/c-sharp-tests/Projects/ParatextDataProviderTests.cs @@ -19,6 +19,7 @@ internal class ParatextDataProviderTests : PsiTestBase private ScrText _scrText = null!; // Will be non-null when the test runs private ProjectDetails _projectDetails = null!; // Will be non-null when the test runs + [SetUp] public override void TestSetup() { base.TestSetup(); @@ -28,6 +29,12 @@ public override void TestSetup() ParatextProjects.FakeAddProject(_projectDetails); } + [TearDown] + public void TearDown() + { + _scrText?.Dispose(); + } + [TestCase("getBookUSFM")] [TestCase("getChapterUSFM")] [TestCase("getVerseUSFM")] diff --git a/c-sharp-tests/Projects/ParatextProjectStorageInterpreterTests.cs b/c-sharp-tests/Projects/ParatextProjectStorageInterpreterTests.cs index 00ede81034..589740b09d 100644 --- a/c-sharp-tests/Projects/ParatextProjectStorageInterpreterTests.cs +++ b/c-sharp-tests/Projects/ParatextProjectStorageInterpreterTests.cs @@ -335,7 +335,7 @@ public async Task SetProjectData_InvalidParameters_ReturnsError( [TestCase(ProjectIdType.Include, "", "Must provide a project name")] public async Task CreateProject_InvalidParameters_ReturnsError( ProjectIdType projectIdType, - string projectName, + string? projectName, string expectedError ) { diff --git a/c-sharp-tests/c-sharp-tests.csproj b/c-sharp-tests/c-sharp-tests.csproj index b0155c53a3..a2faf9da21 100644 --- a/c-sharp-tests/c-sharp-tests.csproj +++ b/c-sharp-tests/c-sharp-tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable @@ -12,11 +12,11 @@ - - - + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -24,7 +24,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/c-sharp/MessageTransports/PapiClient.cs b/c-sharp/MessageTransports/PapiClient.cs index 2a3d470fed..a9affcb992 100644 --- a/c-sharp/MessageTransports/PapiClient.cs +++ b/c-sharp/MessageTransports/PapiClient.cs @@ -97,6 +97,7 @@ private void Dispose(bool isDisposing) if (isDisposing) { _webSocket.Dispose(); + _clientInitializationComplete.TrySetResult(false); _clientInitializationComplete.Task.Dispose(); _cancellationTokenSource.Dispose(); _outgoingMessages.Dispose(); diff --git a/c-sharp/ParanextDataProvider.csproj b/c-sharp/ParanextDataProvider.csproj index 41855d7042..55688c9dbc 100644 --- a/c-sharp/ParanextDataProvider.csproj +++ b/c-sharp/ParanextDataProvider.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable Paranext.DataProvider @@ -22,12 +22,12 @@ - - - - + + + + - +