Skip to content

Commit

Permalink
Lucene.Net.Store.NativeFSLockFactory: Added FEATURE_SUPPORTEDOSPLATFO…
Browse files Browse the repository at this point in the history
…RMATTRIBUTE so we don't have an #ifdef hard coded to a specific target framework. This fixes the CA1416 warning after targeting net8.0, and will make future targeting simpler.
  • Loading branch information
NightOwl888 committed Oct 22, 2024
1 parent c013e23 commit 6844a51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

<DefineConstants>$(DefineConstants);FEATURE_RANDOM_NEXTINT64_NEXTSINGLE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_SPANFORMATTABLE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_SUPPORTEDOSPLATFORMATTRIBUTE</DefineConstants>

</PropertyGroup>

Expand Down
5 changes: 3 additions & 2 deletions src/Lucene.Net/Store/NativeFSLockFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.IO;
using System.Collections.Generic;
using Lucene.Net.Support.Threading;
using System.Runtime.Versioning;

namespace Lucene.Net.Store
{
Expand Down Expand Up @@ -625,7 +626,7 @@ public override string ToString()
}

// Uses FileStream locking of file pages.
#if NET6_0
#if FEATURE_SUPPORTEDOSPLATFORMATTRIBUTE
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
#endif
internal class NativeFSLock : Lock
Expand Down Expand Up @@ -832,4 +833,4 @@ public static void Lock(this FileStream stream, long position, long length)
}
}
#endif
}
}

0 comments on commit 6844a51

Please sign in to comment.