Skip to content

Commit ca766bc

Browse files
committed
Fix CA1308 warning in LINQ expression processing
- Add pragma directive to suppress CA1308 warning with proper rationale - Bing API specifically expects lowercase boolean values (true/false) - ToLowerInvariant() is the correct choice for this API compatibility requirement - All builds now clean with 0 warnings, tests continue to pass (48/48)
1 parent 1e4d3ba commit ca766bc

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

dotnet/src/Plugins/Plugins.Web/Bing/BingTextSearch.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ private static void ProcessEqualityExpression(BinaryExpression binaryExpr, TextS
227227
if (bingFilterName != null && value != null)
228228
{
229229
// Convert boolean values to lowercase strings for Bing API compatibility
230+
// CA1308: Using ToLowerInvariant() is intentional here as Bing API expects boolean values in lowercase format (true/false)
231+
#pragma warning disable CA1308 // Normalize strings to uppercase
230232
string stringValue = value is bool boolValue ? boolValue.ToString().ToLowerInvariant() : value.ToString() ?? string.Empty;
233+
#pragma warning restore CA1308 // Normalize strings to uppercase
231234

232235
if (isNegated)
233236
{

0 commit comments

Comments
 (0)