From 848f9a9ec2c26ae7c71504193392bce1223bc476 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 03:36:43 +0000 Subject: [PATCH 1/3] Bump ANcpLua.Analyzers and ANcpLua.Roslyn.Utilities Bumps ANcpLua.Analyzers from 1.29.1 to 1.29.2 Bumps ANcpLua.Roslyn.Utilities from 2.2.9 to 2.2.12 --- updated-dependencies: - dependency-name: ANcpLua.Analyzers dependency-version: 1.29.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: ancplua-roslyn - dependency-name: ANcpLua.Roslyn.Utilities dependency-version: 2.2.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: ancplua-roslyn ... Signed-off-by: dependabot[bot] --- Version.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Version.props b/Version.props index 3799ab2..c2abecd 100644 --- a/Version.props +++ b/Version.props @@ -20,9 +20,9 @@ - 1.29.1 + 1.29.2 3.0.84 - 2.2.9 + 2.2.12 5.3.0 5.3.0 3.3.4 From 74c8fb1f2e51262f3e24e9fe05d19e3281f68a59 Mon Sep 17 00:00:00 2001 From: ancplua Date: Sat, 16 May 2026 13:00:53 +0200 Subject: [PATCH 2/3] fix: suppress generator analyzer package noise --- src/ErrorOrX.Generators/ErrorOrX.Generators.csproj | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ErrorOrX.Generators/ErrorOrX.Generators.csproj b/src/ErrorOrX.Generators/ErrorOrX.Generators.csproj index c75bf04..3b73aa4 100644 --- a/src/ErrorOrX.Generators/ErrorOrX.Generators.csproj +++ b/src/ErrorOrX.Generators/ErrorOrX.Generators.csproj @@ -29,8 +29,15 @@ ANcpLua.Roslyn.Utilities.Sources (AsyncBatchingWorkQueue, IncrementalValuesProviderExtensions). These are deliberate try/catch patterns in resilient infrastructure code. .editorconfig cannot suppress diagnostics in NuGet cache paths. + + AL0140: The generator emitter code intentionally relies on local type inference for + Roslyn syntax construction where explicit types add noise rather than safety. + + RS1035: ANcpLua.Roslyn.Utilities.Sources contains environment-variable checks in + source-package infrastructure; suppress here until the upstream package removes that + analyzer-host API usage. --> - $(NoWarn);NU5128;RS1038;ERP022 + $(NoWarn);NU5128;RS1038;ERP022;AL0140;RS1035 true true false From 2e72f69f55bd5eec0a40782427adaa7e81aa797a Mon Sep 17 00:00:00 2001 From: ancplua Date: Sat, 16 May 2026 13:03:25 +0200 Subject: [PATCH 3/3] fix: satisfy roslyn utility analyzer bump --- .../Analyzers/ErrorOrEndpointAnalyzer.cs | 4 ++-- .../Core/ErrorOrEndpointGenerator.Initialize.cs | 4 ++-- .../Core/ErrorOrEndpointGenerator.ParameterBinding.cs | 8 ++++---- src/ErrorOrX.Generators/OpenApiTransformerGenerator.cs | 10 ++++------ 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/ErrorOrX.Generators/Analyzers/ErrorOrEndpointAnalyzer.cs b/src/ErrorOrX.Generators/Analyzers/ErrorOrEndpointAnalyzer.cs index 7593101..a3f8025 100644 --- a/src/ErrorOrX.Generators/Analyzers/ErrorOrEndpointAnalyzer.cs +++ b/src/ErrorOrX.Generators/Analyzers/ErrorOrEndpointAnalyzer.cs @@ -1,3 +1,4 @@ +using ANcpLua.Roslyn.Utilities; using ErrorOr.Generators; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; @@ -388,8 +389,7 @@ private static bool IsErrorOr(ITypeSymbol type) // Extract pattern from constructor arguments var patternIndex = attrName.Contains("ErrorOrEndpoint") ? 1 : 0; - if (attr.ConstructorArguments.Length > patternIndex && - attr.ConstructorArguments[patternIndex].Value is string p) + if (attr.GetConstructorArgument(patternIndex) is { } p) { pattern = p; } diff --git a/src/ErrorOrX.Generators/Core/ErrorOrEndpointGenerator.Initialize.cs b/src/ErrorOrX.Generators/Core/ErrorOrEndpointGenerator.Initialize.cs index be4441e..97a6f1d 100644 --- a/src/ErrorOrX.Generators/Core/ErrorOrEndpointGenerator.Initialize.cs +++ b/src/ErrorOrX.Generators/Core/ErrorOrEndpointGenerator.Initialize.cs @@ -1,4 +1,5 @@ using ANcpLua.Roslyn.Utilities.Models; +using ANcpLua.Roslyn.Utilities; using ErrorOr.Analyzers; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -477,8 +478,7 @@ private static (HttpVerb? Verb, string Pattern, string? CustomMethod) ExtractHtt // Extract pattern - index differs for ErrorOrEndpoint (has httpMethod arg first) var patternIndex = isErrorOrEndpoint ? 1 : 0; - var pattern = attr.ConstructorArguments.Length > patternIndex && - attr.ConstructorArguments[patternIndex].Value is string p + var pattern = attr.GetConstructorArgument(patternIndex) is { } p ? p : "/"; diff --git a/src/ErrorOrX.Generators/Core/ErrorOrEndpointGenerator.ParameterBinding.cs b/src/ErrorOrX.Generators/Core/ErrorOrEndpointGenerator.ParameterBinding.cs index 1920e85..f52d30b 100644 --- a/src/ErrorOrX.Generators/Core/ErrorOrEndpointGenerator.ParameterBinding.cs +++ b/src/ErrorOrX.Generators/Core/ErrorOrEndpointGenerator.ParameterBinding.cs @@ -1,4 +1,5 @@ using System.Text.RegularExpressions; +using ANcpLua.Roslyn.Utilities; using ANcpLua.Roslyn.Utilities.Matching; using ANcpLua.Roslyn.Utilities.Models; using ErrorOr.Analyzers; @@ -860,9 +861,9 @@ private static (bool IsNullable, bool IsNonNullableValueType) GetParameterNullab var matcher = new AttributeNameMatcher(WellKnownTypes.FromKeyedServicesAttribute); var attr = parameter.GetAttributes().FirstOrDefault(a => matcher.IsMatch(a.AttributeClass)); - if (attr is null || attr.ConstructorArguments.Length is 0) return null; + if (attr is null) return null; - var val = attr.ConstructorArguments[0].Value; + var val = attr.GetConstructorArgument(0); return val switch { string s => $"\"{s}\"", null => null, _ => val.ToString() }; } @@ -892,8 +893,7 @@ private static bool HasParameterAttribute(ISymbol parameter, ErrorOrContext cont } } - if (attr.ConstructorArguments.Length > 0 && - attr.ConstructorArguments[0].Value is string ctorArg && + if (attr.GetConstructorArgument(0) is { } ctorArg && !string.IsNullOrWhiteSpace(ctorArg)) { return ctorArg; diff --git a/src/ErrorOrX.Generators/OpenApiTransformerGenerator.cs b/src/ErrorOrX.Generators/OpenApiTransformerGenerator.cs index 9408966..943e05f 100644 --- a/src/ErrorOrX.Generators/OpenApiTransformerGenerator.cs +++ b/src/ErrorOrX.Generators/OpenApiTransformerGenerator.cs @@ -1,3 +1,4 @@ +using ANcpLua.Roslyn.Utilities; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; @@ -110,8 +111,7 @@ private static IncrementalValuesProvider CreateEndpointProv private static string GetPattern(AttributeData attr) { - if (attr.ConstructorArguments.Length > 0 && - attr.ConstructorArguments[0].Value is string p && + if (attr.GetConstructorArgument(0) is { } p && !string.IsNullOrWhiteSpace(p)) { return p; @@ -122,10 +122,8 @@ attr.ConstructorArguments[0].Value is string p && private static (string? httpMethod, string? pattern) GetBaseAttributeInfo(AttributeData attr) { - if (attr.ConstructorArguments.Length < 2) return (null, null); - - var method = attr.ConstructorArguments[0].Value as string; - var pattern = attr.ConstructorArguments[1].Value as string; + var method = attr.GetConstructorArgument(0); + var pattern = attr.GetConstructorArgument(1); return string.IsNullOrWhiteSpace(method) ? (null, null)