AlmarAubel / CSharpFunctionalExtensions.Analyzers

Code analyzers for CSharpFunctionalExtensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False postive warning of accessing value without checking with ternary operator

HipDragon opened this issue · comments

When you use the ternary operator like string resultMessage = result.IsSuccess ? $"{result.Value} success." : "Failed."; you get warning CFE0001 "Accessing Value without checking IsSuccess or IsFailure can result in an unexpected Errors". This is incorrect because the ternary operator is checking the value. Converting the ternary operator into a if else statement removes the warning.

Thank you for reporting the bug. Sorry that it took so long to fix this issue. I've released version 1.41 of the package which should address this issue. Could you please verify if this version resolves the warning?