From 2e9cf0558ed8a8afb0bd527bbed623ec6f699c97 Mon Sep 17 00:00:00 2001 From: ancplua Date: Fri, 4 Sep 2026 09:56:04 +0200 Subject: [PATCH] =?UTF-8?q?deps:=20staleness=20sweep=20=E2=80=94=20every?= =?UTF-8?q?=20pin=20to=20latest=20published?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Version.props is SDK truth and flows into every consumer, so a stale pin there is a stale pin everywhere. Sweep of all published packages the SDK names (flat-container index cross-checked against the search API, so an unlisted version cannot masquerade as latest): DotNetSdkVersion 10.0.301 -> 10.0.400 (also NetAnalyzersVersion, i.e. Microsoft.CodeAnalysis.NetAnalyzers, and the .NET SDK stamped into the dotnet-new templates' global.json) Basic.Reference.Assemblies.Net100 1.8.9 -> 1.8.11 Meziantou.Framework 6.0.1 -> 6.0.4 Meziantou.Framework.FullPath 3.0.1 -> 3.0.4 Meziantou.Framework.ProcessWrapper 2.0.1 -> 2.0.4 Meziantou.Framework.TemporaryDirectory 3.0.1 -> 3.0.4 xunit.v3.mtp-v2 3.2.2 -> 4.0.0 AwesomeAssertions 9.4.0 -> 9.6.0 Microsoft.Testing.Platform (+ the five MTP extensions) 2.3.2 -> 2.4.0 Microsoft.Testing.Extensions.CodeCoverage 18.9.0 -> 18.11.0 GitHubActionsTestLogger 3.0.4 -> 3.0.5 ANcpLua.Analyzers 2.1.1 -> 2.1.2 Microsoft.Extensions (dotnet/extensions family) 10.8.0 -> 10.9.0 AspNetCoreVersion 10.0.10 -> 10.0.11 Microsoft.Bcl.AsyncInterfaces 10.0.10 -> 10.0.11 NuGet.Protocol / NuGet.Packaging 7.6.0 -> 7.9.0 MSBuild.StructuredLogger 2.3.213 -> 2.3.246 Microsoft.Agents.AI (stable track) 1.13.0 -> 1.20.0 Microsoft.Agents.AI (preview track) 1.13.0-preview.260703.1 -> 1.20.0-preview.260831.1 global.json ANcpLua.NET.Sdk.Test 3.4.44 -> 3.4.46 (self-pin points at last PUBLISHED, per the bootstrap rule) Already latest, unchanged: Roslyn 5.9.0, Microsoft.CodeAnalysis.Analyzers 5.9.0, Microsoft.CodeAnalysis.BannedApiAnalyzers 5.6.0, AwesomeAssertions.Analyzers 9.0.8, Microsoft.Sbom.Targets 4.1.5, Microsoft.Deployment.DotNet.Releases 1.0.2. Fallout the bumps exposed, fixed rather than capped: - NuGet 7.9.0 annotates GetResourceAsync() and DownloadResourceResult.PackageReader as nullable, so ConfigFilesGenerator hit six CS8602 under TreatWarningsAsErrors. Each site now throws with the source/package it could not resolve instead of dereferencing blind. - Meziantou.Framework.FullPath 3.0.4 ships MFFP0015, which caught Build_WhenEditorConfigFileExists_IncludedInBinlog comparing a FullPath by its ordinal string form. The macOS /private realpath variant is now built as a FullPath and compared with the platform's comparer. ANcpLua.Analyzers 2.1.2 is the release that makes work at all: its three profiles shipped as sectioned analyzer configs, whose globs Roslyn resolves relative to the package folder, so every profile was inert. The Version.props comment is rewritten to say so. src/Config/Analyzer.xunit.analyzers.editorconfig regenerated by ConfigFilesGenerator for xunit.v3 4.0.0: 21 new rules (xUnit1054-1069, xUnit2033, xUnit3004-3007). Gates: dotnet build -c Release clean; all 245 SDK behaviour tests pass (they pack the SDK and build throwaway consumers against it). Co-Authored-By: Claude Fable 5.1 --- global.json | 2 +- src/Build/Common/Version.props | 63 +++++------ .../Analyzer.xunit.analyzers.editorconfig | 105 ++++++++++++++++++ tests/ANcpLua.Sdk.Tests/SdkTests.cs | 9 +- tools/ConfigFilesGenerator/Program.cs | 28 +++-- 5 files changed, 165 insertions(+), 42 deletions(-) diff --git a/global.json b/global.json index 863d5e3..9710807 100644 --- a/global.json +++ b/global.json @@ -5,7 +5,7 @@ "allowPrerelease": true }, "msbuild-sdks": { - "ANcpLua.NET.Sdk.Test": "3.4.44" + "ANcpLua.NET.Sdk.Test": "3.4.46" }, "test": { "runner": "Microsoft.Testing.Platform" diff --git a/src/Build/Common/Version.props b/src/Build/Common/Version.props index b61746b..ee732c6 100644 --- a/src/Build/Common/Version.props +++ b/src/Build/Common/Version.props @@ -9,7 +9,7 @@ - 10.0.301 + 10.0.400 latestMinor @@ -19,54 +19,55 @@ - 1.8.9 + 1.8.11 - 6.0.1 - 3.0.1 - 2.0.1 - 3.0.1 + 6.0.4 + 3.0.4 + 2.0.4 + 3.0.4 - 3.2.2 - 9.4.0 + 4.0.0 + 9.6.0 9.0.8 - 2.3.2 - 18.9.0 - 3.0.4 + 2.4.0 + 18.11.0 + 3.0.5 - - 2.1.1 + 2.1.2 $(DotNetSdkVersion) 4.1.5 5.6.0 - 10.8.0 - 10.0.10 - 10.0.10 + 10.9.0 + 10.0.11 + 10.0.11 - 7.6.0 - 2.3.213 + 7.9.0 + 2.3.246 - 1.13.0 - 1.13.0 - 1.13.0 - 1.13.0 - 1.13.0-preview.260703.1 - 1.13.0-preview.260703.1 - 1.13.0-preview.260703.1 - 1.13.0-preview.260703.1 - 1.13.0 + 1.20.0 + 1.20.0 + 1.20.0 + 1.20.0 + 1.20.0-preview.260831.1 + 1.20.0-preview.260831.1 + 1.20.0-preview.260831.1 + 1.20.0-preview.260831.1 + 1.20.0 diff --git a/src/Config/Analyzer.xunit.analyzers.editorconfig b/src/Config/Analyzer.xunit.analyzers.editorconfig index 75f0241..53579f4 100644 --- a/src/Config/Analyzer.xunit.analyzers.editorconfig +++ b/src/Config/Analyzer.xunit.analyzers.editorconfig @@ -273,6 +273,86 @@ dotnet_diagnostic.xUnit1052.severity = warning # Enabled: True, Severity: warning dotnet_diagnostic.xUnit1053.severity = warning +# xUnit1054: Properties used for conditional skipping must be public, static, and return bool +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1054 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1054.severity = error + +# xUnit1055: Conditional skipping cannot set both SkipUnless and SkipWhen +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1055 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1055.severity = error + +# xUnit1056: Type must have a single public non-static constructor +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1056 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1056.severity = error + +# xUnit1057: Type must be public or internal +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1057 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1057.severity = error + +# xUnit1058: Generic collection definitions are not supported in Native AOT +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1058 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1058.severity = error + +# xUnit1059: Test classes may not be decorated with ICollectionFixture<> +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1059 +# Enabled: True, Severity: warning +dotnet_diagnostic.xUnit1059.severity = warning + +# xUnit1060: Cultured test methods must have at least one culture +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1060 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1060.severity = error + +# xUnit1061: Fact methods cannot be generic +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1061 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1061.severity = error + +# xUnit1062: Theory methods cannot be generic in Native AOT +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1062 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1062.severity = error + +# xUnit1063: Test classes cannot be an open generic type +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1063 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1063.severity = error + +# xUnit1064: Theory parameter cannot use params modifier in Native AOT +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1064 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1064.severity = error + +# xUnit1065: MemberData method is ambiguous +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1065 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1065.severity = error + +# xUnit1066: MemberData parameter cannot use params modifier in Native AOT +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1066 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1066.severity = error + +# xUnit1067: There is no matching MemberData method argument +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1067 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1067.severity = error + +# xUnit1068: MemberData cannot point to an open generic type +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1068 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit1068.severity = error + +# xUnit1069: Test methods with a Timeout should reference TestContext.Current.CancellationToken +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit1069 +# Enabled: True, Severity: warning +dotnet_diagnostic.xUnit1069.severity = warning + # xUnit2000: Constants and literals should be the expected argument # Help link: https://xunit.net/xunit.analyzers/rules/xUnit2000 # Enabled: True, Severity: warning @@ -433,6 +513,11 @@ dotnet_diagnostic.xUnit2031.severity = warning # Enabled: True, Severity: suggestion dotnet_diagnostic.xUnit2032.severity = suggestion +# xUnit2033: Use the assertion return value instead of re-deriving it +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit2033 +# Enabled: True, Severity: suggestion +dotnet_diagnostic.xUnit2033.severity = suggestion + # xUnit3000: Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject # Help link: https://xunit.net/xunit.analyzers/rules/xUnit3000 # Enabled: True, Severity: error @@ -452,3 +537,23 @@ dotnet_diagnostic.xUnit3002.severity = warning # Help link: https://xunit.net/xunit.analyzers/rules/xUnit3003 # Enabled: True, Severity: warning dotnet_diagnostic.xUnit3003.severity = warning + +# xUnit3004: The given type is missing a required interface implementation +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit3004 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit3004.severity = error + +# xUnit3005: Type must have an appropriate non-obsolete public constructor +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit3005 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit3005.severity = error + +# xUnit3006: Test case implementation must be serializable +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit3006 +# Enabled: True, Severity: error +dotnet_diagnostic.xUnit3006.severity = error + +# xUnit3007: Test case implementation might not be serializable +# Help link: https://xunit.net/xunit.analyzers/rules/xUnit3007 +# Enabled: True, Severity: warning +dotnet_diagnostic.xUnit3007.severity = warning diff --git a/tests/ANcpLua.Sdk.Tests/SdkTests.cs b/tests/ANcpLua.Sdk.Tests/SdkTests.cs index 80f9ba1..55ed734 100644 --- a/tests/ANcpLua.Sdk.Tests/SdkTests.cs +++ b/tests/ANcpLua.Sdk.Tests/SdkTests.cs @@ -258,7 +258,14 @@ public async Task Build_WhenEditorConfigFileExists_IncludedInBinlog() var files = result.GetBinLogFiles(); Assert.Contains(files, static f => f.EndsWith(".editorconfig", StringComparison.Ordinal)); - Assert.Contains(files, f => f == localFile || f == "/private" + localFile); + + // macOS resolves the /var symlink behind the temp folder, so the binlog records the + // /private-prefixed realpath. Compare as FullPath so the platform's path comparer + // decides, not an ordinal string compare (MFFP0015). + FullPath[] expected = OperatingSystem.IsMacOS() + ? [localFile, FullPath.FromPath("/private" + localFile)] + : [localFile]; + Assert.Contains(files, f => expected.Contains(FullPath.FromPath(f))); } [Fact] diff --git a/tools/ConfigFilesGenerator/Program.cs b/tools/ConfigFilesGenerator/Program.cs index 5d70948..d78eef5 100644 --- a/tools/ConfigFilesGenerator/Program.cs +++ b/tools/ConfigFilesGenerator/Program.cs @@ -458,7 +458,9 @@ async Task GenerateBanSymbolsForNewtonsoftJson() var package = await DownloadNuGetPackage("Newtonsoft.Json", null, NullLogger.Instance, CancellationToken.None) .ConfigureAwait(false); - var libItems = await package.PackageReader.GetLibItemsAsync(CancellationToken.None).ConfigureAwait(false); + var packageReader = package.PackageReader + ?? throw new InvalidOperationException("Downloaded package 'Newtonsoft.Json' has no reader."); + var libItems = await packageReader.GetLibItemsAsync(CancellationToken.None).ConfigureAwait(false); var compatibleFrameworks = libItems.Where(item => DefaultCompatibilityProvider.Instance.IsCompatible(NuGetFramework.Parse("net10.0"), item.TargetFramework)); @@ -468,7 +470,7 @@ async Task GenerateBanSymbolsForNewtonsoftJson() if (!string.Equals(Path.GetExtension(item), ".dll", StringComparison.OrdinalIgnoreCase)) continue; - await using var stream = package.PackageReader.GetStream(item); + await using var stream = packageReader.GetStream(item); var metadataRef = MetadataReference.CreateFromStream(stream); var allRefs = Net100.References.All.Add(metadataRef); @@ -657,7 +659,8 @@ static string NormalizeCondition(string condition) => using var cache = new SourceCacheContext(); var repository = Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json"); - var resource = await repository.GetResourceAsync().ConfigureAwait(false); + var resource = await repository.GetResourceAsync().ConfigureAwait(false) + ?? throw new InvalidOperationException("nuget.org does not expose a PackageMetadataResource."); foreach (var package in GetReferencedNuGetPackages()) { @@ -735,7 +738,9 @@ static async Task ListAllPackageDependencies( foreach (var repository in sourceRepositories) { var dependencyInfoResource = - await repository.GetResourceAsync().ConfigureAwait(false); + await repository.GetResourceAsync().ConfigureAwait(false) + ?? throw new InvalidOperationException( + $"Source '{repository.PackageSource.Source}' does not expose a DependencyInfoResource."); var dependencyInfo = await dependencyInfoResource.ResolvePackage(package, framework, cache, logger, cancellationToken) .ConfigureAwait(false); @@ -862,8 +867,10 @@ static async Task GetAnalyzerReferences(string packageId, NuGetVersi var cancellationToken = CancellationToken.None; var package = await DownloadNuGetPackage(packageId, version, logger, cancellationToken).ConfigureAwait(false); + var packageReader = package.PackageReader + ?? throw new InvalidOperationException($"Downloaded package '{packageId}' has no reader."); var result = new List(); - var files = package.PackageReader.GetFiles("analyzers"); + var files = packageReader.GetFiles("analyzers"); var filesGroupedByFolder = files.GroupBy(Path.GetDirectoryName).ToArray(); foreach (var group in filesGroupedByFolder) { @@ -884,7 +891,7 @@ static async Task GetAnalyzerReferences(string packageId, NuGetVersi string.Equals(Path.GetFileName(f), assemblyFileName, StringComparison.OrdinalIgnoreCase)); if (assemblyPath != null) { - using var stream = package.PackageReader.GetStream(assemblyPath); + using var stream = packageReader.GetStream(assemblyPath); return context.LoadFromStream(stream); } } @@ -910,7 +917,7 @@ IEnumerable GetProbeFolders() try { - await using var stream = package.PackageReader.GetStream(file); + await using var stream = packageReader.GetStream(file); result.Add(context.LoadFromStream(stream)); } catch (Exception ex) @@ -1007,11 +1014,14 @@ static async Task DownloadNuGetPackage(string packageId, using var cache = new SourceCacheContext(); var repository = Repository.Factory.GetCoreV3(Source); - var resource = await repository.GetResourceAsync().ConfigureAwait(false); + var resource = await repository.GetResourceAsync().ConfigureAwait(false) + ?? throw new InvalidOperationException($"Source '{Source}' does not expose a FindPackageByIdResource."); if (version is null) { - var metadataResource = await repository.GetResourceAsync().ConfigureAwait(false); + var metadataResource = await repository.GetResourceAsync().ConfigureAwait(false) + ?? throw new InvalidOperationException( + $"Source '{Source}' does not expose a PackageMetadataResource."); var metadata = await metadataResource.GetMetadataAsync(packageId, true, false, cache, NullLogger.Instance, CancellationToken.None).ConfigureAwait(false); var latestPackage = metadata.MaxBy(static m => m.Identity.Version)