Skip to content

Commit

Permalink
Resolve System.InvalidCastException
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthurvdv committed Dec 8, 2023
1 parent 44e2c81 commit a4d5f53
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Design/Rule0043SecretText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ private void AnalyzeHttpObjects(OperationAnalysisContext ctx)
{
case MethodKind.BuiltInMethod:
if (!buildInMethodNames.Contains(operation.TargetMethod.Name.ToLowerInvariant())) return;

// We need to verify that the method is called from a HttpHeaders or HttpClient object
if (!ctx.Operation.DescendantsAndSelf().Where(x => x.GetSymbol() != null)
.Where(x => x.Type.GetNavTypeKindSafe() == NavTypeKind.HttpHeaders || x.Type.GetNavTypeKindSafe() == NavTypeKind.HttpClient)
.Any()) return;
if (!(operation.Instance?.GetSymbol().GetTypeSymbol().GetNavTypeKindSafe() == NavTypeKind.HttpHeaders || operation.Instance?.GetSymbol().GetTypeSymbol().GetNavTypeKindSafe() == NavTypeKind.HttpClient)) return;
break;
case MethodKind.Method:
if (operation.TargetMethod.ContainingType.GetNavTypeKindSafe() != NavTypeKind.Codeunit) return;
Expand Down

0 comments on commit a4d5f53

Please sign in to comment.