diff --git a/.build/azure-templates/publish-test-results-for-test-projects.yml b/.build/azure-templates/publish-test-results-for-test-projects.yml index a113396c0e..ec2a1237da 100644 --- a/.build/azure-templates/publish-test-results-for-test-projects.yml +++ b/.build/azure-templates/publish-test-results-for-test-projects.yml @@ -74,7 +74,7 @@ steps: - template: publish-test-results.yml parameters: testProjectName: 'Lucene.Net.Tests.CodeAnalysis' - framework: 'net5.0' # Since condtions are not supported for templates, we check for the file existence within publish-test-results.yml + framework: 'net8.0' # Since condtions are not supported for templates, we check for the file existence within publish-test-results.yml vsTestPlatform: '${{ parameters.vsTestPlatform }}' osName: '${{ parameters.osName }}' testResultsFormat: '${{ parameters.testResultsFormat }}' diff --git a/.github/workflows/Lucene-Net-Tests-CodeAnalysis.yml b/.github/workflows/Lucene-Net-Tests-CodeAnalysis.yml index 886a49b90d..8a06e864df 100644 --- a/.github/workflows/Lucene-Net-Tests-CodeAnalysis.yml +++ b/.github/workflows/Lucene-Net-Tests-CodeAnalysis.yml @@ -49,7 +49,7 @@ jobs: fail-fast: false matrix: os: [windows-latest, ubuntu-latest] - framework: [net5.0] + framework: [net8.0] platform: [x64] configuration: [Release] exclude: diff --git a/Lucene.Net.sln b/Lucene.Net.sln index 7f6fa0562d..3c51015dc7 100644 --- a/Lucene.Net.sln +++ b/Lucene.Net.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 +# Visual Studio Version 17 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -16,7 +16,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -VisualStudioVersion = 16.0.29806.167 +VisualStudioVersion = 17.10.35004.147 MinimumVisualStudioVersion = 15.0.26730.8 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "azure-templates", "azure-templates", "{05CE3A39-40D4-452D-AFE0-E57E536A08C6}" ProjectSection(SolutionItems) = preProject @@ -41,10 +41,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{4016BD build = build build.bat = build.bat build.ps1 = build.ps1 - .build\runbuild.ps1 = .build\runbuild.ps1 .build\dependencies.props = .build\dependencies.props .build\nuget.props = .build\nuget.props .build\release.targets = .build\release.targets + .build\runbuild.ps1 = .build\runbuild.ps1 .build\TestReferences.Common.targets = .build\TestReferences.Common.targets TestTargetFramework.props = TestTargetFramework.props EndProjectSection @@ -263,7 +263,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.AllProject EndProject Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "websites", "websites\", "{8988CDA4-8420-4BEE-869A-66825055EED2}" ProjectSection(WebsiteProperties) = preProject - TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.6.2" + TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.8" Debug.AspNetCompiler.VirtualPath = "/localhost_59352" Debug.AspNetCompiler.PhysicalPath = "websites\" Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_59352\" diff --git a/src/Lucene.Net/Index/IndexReader.cs b/src/Lucene.Net/Index/IndexReader.cs index f8fa305276..518cbde041 100644 --- a/src/Lucene.Net/Index/IndexReader.cs +++ b/src/Lucene.Net/Index/IndexReader.cs @@ -3,9 +3,11 @@ using Lucene.Net.Support; using Lucene.Net.Support.Threading; using Lucene.Net.Util; + #if !FEATURE_CONDITIONALWEAKTABLE_ENUMERATOR using Lucene.Net.Util.Events; #endif + using System; using System.Collections; using System.Collections.Generic; @@ -655,12 +657,6 @@ internal void SubscribeToGetCacheKeysEvent(WeakEvents.GetCacheKeysEvent getCache getCacheKeysEvent.Subscribe(OnGetCacheKeys); } - // LUCENENET specific: Clean up the weak event handler if this class goes out of scope - ~IndexReader() - { - Dispose(false); - } - // LUCENENET specific: Add weak event handler for .NET Standard 2.0 and .NET Framework, since we don't have an enumerator to use private void OnGetParentReaders(WeakEvents.GetParentReadersEventArgs e) { @@ -781,4 +777,4 @@ public interface IReaderDisposedListener /// Invoked when the is disposed. void OnDispose(IndexReader reader); } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Support/ObsoleteAPI/IndexReader.cs b/src/Lucene.Net/Support/ObsoleteAPI/IndexReader.cs index 806fb58e6a..63716cdb67 100644 --- a/src/Lucene.Net/Support/ObsoleteAPI/IndexReader.cs +++ b/src/Lucene.Net/Support/ObsoleteAPI/IndexReader.cs @@ -39,6 +39,7 @@ public interface IReaderClosedListener private sealed class ReaderCloseListenerWrapper : IReaderDisposedListener { private readonly IReaderClosedListener listener; + public ReaderCloseListenerWrapper(IReaderClosedListener listener) { this.listener = listener ?? throw new ArgumentNullException(nameof(listener)); @@ -47,7 +48,9 @@ public ReaderCloseListenerWrapper(IReaderClosedListener listener) public void OnDispose(IndexReader reader) => listener.OnClose(reader); public override bool Equals(object obj) => listener.Equals(obj); + public override int GetHashCode() => listener.GetHashCode(); + public override string ToString() => listener.ToString(); } @@ -57,7 +60,7 @@ public ReaderCloseListenerWrapper(IReaderClosedListener listener) /// /// @lucene.experimental /// - [Obsolete("Use AddReaderDisposedListerner method instead. This method will be removed in 4.8.0 release candidate."), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + [Obsolete("Use AddReaderDisposedListener method instead. This method will be removed in 4.8.0 release candidate."), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public void AddReaderClosedListener(IReaderClosedListener listener) { EnsureOpen(); @@ -69,7 +72,7 @@ public void AddReaderClosedListener(IReaderClosedListener listener) /// /// @lucene.experimental /// - [Obsolete("Use RemoveReaderDisposedListerner method instead. This method will be removed in 4.8.0 release candidate."), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + [Obsolete("Use RemoveReaderDisposedListener method instead. This method will be removed in 4.8.0 release candidate."), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public void RemoveReaderClosedListener(IReaderClosedListener listener) { EnsureOpen(); diff --git a/src/dotnet/Lucene.Net.Tests.CodeAnalysis/Lucene.Net.Tests.CodeAnalysis.csproj b/src/dotnet/Lucene.Net.Tests.CodeAnalysis/Lucene.Net.Tests.CodeAnalysis.csproj index 768f84ad1b..6c5e8e0573 100644 --- a/src/dotnet/Lucene.Net.Tests.CodeAnalysis/Lucene.Net.Tests.CodeAnalysis.csproj +++ b/src/dotnet/Lucene.Net.Tests.CodeAnalysis/Lucene.Net.Tests.CodeAnalysis.csproj @@ -22,17 +22,13 @@ - net5.0 + net8.0 Lucene.Net.CodeAnalysis false - true + true true - - - false -