Skip to content

Commit

Permalink
Merge pull request #418 from StefanMaron/development
Browse files Browse the repository at this point in the history
Resolve System.InvalidCastException on rule0043
  • Loading branch information
Arthurvdv authored Dec 8, 2023
2 parents 97f438e + a4d5f53 commit e50a7c8
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 e50a7c8

Please sign in to comment.