From a17653c1694efe7dff9605f250f92b5e704f6111 Mon Sep 17 00:00:00 2001 From: Kyle Burrows Date: Thu, 13 Nov 2025 18:58:29 -0500 Subject: [PATCH] fix an issue where optional Arguments are not working correctly with a null value and they become required --- src/MinimalCli.SourceGenerator/GeneratorBindingsProvider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MinimalCli.SourceGenerator/GeneratorBindingsProvider.cs b/src/MinimalCli.SourceGenerator/GeneratorBindingsProvider.cs index a4a182b..602e1c8 100644 --- a/src/MinimalCli.SourceGenerator/GeneratorBindingsProvider.cs +++ b/src/MinimalCli.SourceGenerator/GeneratorBindingsProvider.cs @@ -232,7 +232,7 @@ private static void BindServiceDescriptor(this List list, stri private static string? GetSymbolDefaultValue(GeneratorAttributeSyntaxContext ctx, IParameterSymbol param) { - static string FormatLiteral(object value) + static string FormatLiteral(object? value) { return value switch { @@ -245,7 +245,7 @@ static string FormatLiteral(object value) }; } - if (param.HasExplicitDefaultValue && param.ExplicitDefaultValue is not null) + if (param.HasExplicitDefaultValue) { SyntaxReference? syntaxRef = param.DeclaringSyntaxReferences.FirstOrDefault(); if (syntaxRef?.GetSyntax() is ParameterSyntax paramSyntax && paramSyntax.Default is not null)