1 implementation of TargetMethod
Microsoft.CodeAnalysis (1)
Generated\Operations.Generated.cs (1)
5164public IMethodSymbol TargetMethod { get; }
146 references to TargetMethod
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.cs (1)
58var targetMethod = invocation.TargetMethod;
ConfigurationSchemaGenerator (10)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
84IMethodSymbol targetMethod = invocation.Operation.TargetMethod;
RuntimeSource\Configuration.Binder\Parser\BinderInvocation.cs (1)
54if (operation.TargetMethod is not IMethodSymbol
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (4)
19switch (invocation.Operation.TargetMethod.Name) 42ImmutableArray<IParameterSymbol> @params = operation.TargetMethod.Parameters; 136IMethodSymbol targetMethod = operation.TargetMethod; 191IMethodSymbol targetMethod = operation.TargetMethod;
RuntimeSource\Configuration.Binder\Parser\OptionsBuilderConfigurationExtensions.cs (3)
17IMethodSymbol targetMethod = invocation.Operation.TargetMethod; 45IMethodSymbol targetMethod = operation.TargetMethod; 72IMethodSymbol targetMethod = invocation.Operation.TargetMethod;
RuntimeSource\Configuration.Binder\Parser\OptionsConfigurationServiceCollectionExtensions.cs (1)
18IMethodSymbol targetMethod = operation.TargetMethod;
ILLink.RoslynAnalyzer (2)
COMAnalyzer.cs (1)
41 var targetMethod = invocationOperation.TargetMethod;
DataFlow\LocalDataFlowVisitor.cs (1)
553 => ProcessMethodCall (operation, operation.TargetMethod, operation.Instance, operation.Arguments, state);
Microsoft.Analyzers.Extra (8)
AsyncCallInsideUsingBlockAnalyzer.cs (1)
199return invocation.TargetMethod.Name is "Wait" or "GetAwaiter";
CallAnalysis\Arrays.cs (1)
101static void HandleMethod(OperationAnalysisContext context, IInvocationOperation op) => HandleSuspectType(context, (INamedTypeSymbol)op.TargetMethod.ReturnType, op.Syntax.GetLocation());
CallAnalysis\CallAnalyzer.Handlers.cs (1)
24var target = op.TargetMethod;
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
103var method = invocationOp.TargetMethod;
CallAnalysis\StartsEndsWith.cs (1)
59var diagnostic = Diagnostic.Create(DiagDescriptors.StartsEndsWith, op.Syntax.GetLocation(), op.TargetMethod.Name);
ConditionalAccessAnalyzer.cs (1)
67if (MaybeNull(invocation.TargetMethod.GetReturnTypeAttributes()))
UsingToStringInLoggersAnalyzer.cs (2)
41if (IsLoggerMethod(invocation.TargetMethod)) 67&& argOperation.TargetMethod.Name == "ToString")
Microsoft.Analyzers.Local (1)
CallAnalysis\CallAnalyzer.Handlers.cs (1)
24var target = op.TargetMethod;
Microsoft.AspNetCore.Analyzers (3)
CompilationFeatureDetector.cs (1)
48.Any(op => StartupFacts.IsSignalRConfigureMethodGesture(op.TargetMethod)))
MiddlewareItem.cs (1)
18public IMethodSymbol UseMethod => Operation.TargetMethod;
ServicesItem.cs (1)
18public IMethodSymbol UseMethod => Operation.TargetMethod;
Microsoft.AspNetCore.App.Analyzers (27)
Authorization\AddAuthorizationBuilderAnalyzer.cs (5)
57if (SymbolEqualityComparer.Default.Equals(invocation.TargetMethod, addAuthorizationMethod) 58&& SymbolEqualityComparer.Default.Equals(invocation.TargetMethod.ContainingType, policyServiceCollectionExtensions) 153if (expressionStatementOperation is IInvocationOperation { TargetMethod.ContainingType: { } invokedMethodContainingType } 214&& SymbolEqualityComparer.Default.Equals(invocationOperation.TargetMethod, authorizationOptionsTypes.GetPolicy) 215&& SymbolEqualityComparer.Default.Equals(invocationOperation.TargetMethod.ContainingType, authorizationOptionsTypes.AuthorizationOptions))
Http\HeaderDictionaryAddAnalyzer.cs (2)
34if (IsAddMethod(invocation.TargetMethod) 35&& invocation.TargetMethod.Parameters.Length == 2
Kestrel\ListenOnIPv6AnyAnalyzer.cs (1)
112TargetMethod: { Name: "Listen" },
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
34if (!IsRenderTreeBuilderMethodWithSequenceParameter(wellKnownTypes, invocation.TargetMethod))
RouteHandlers\DetectAmbiguousRoutes.cs (6)
95var method = invocationOperation.TargetMethod; 196if (invocation.TargetMethod.Name == "MapGroup" && 197invocation.TargetMethod.Parameters.Length == 2 && 198SymbolEqualityComparer.Default.Equals(invocation.TargetMethod, otherInvocation.TargetMethod) && 206return AreArgumentsEqual(invocation.TargetMethod, invocation.Arguments, otherInvocation.Arguments);
RouteHandlers\DetectMisplacedLambdaAttribute.cs (2)
79return invocationReturn.TargetMethod; 90return invocationExpression.TargetMethod;
RouteHandlers\DisallowMvcBindArgumentsOnParameters.cs (1)
36var methodName = invocation.TargetMethod.Name;
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (2)
50invocationOperation.TargetMethod.Name)); 84invocationOperation.TargetMethod.Name));
RouteHandlers\RouteHandlerAnalyzer.cs (1)
71var targetMethod = invocation.TargetMethod;
src\Shared\Roslyn\CodeAnalysisExtensions.cs (4)
185else if (invocation.TargetMethod.IsExtensionMethod && !invocation.TargetMethod.Parameters.IsEmpty) 192else if (invocation.TargetMethod.Parameters[0].IsParams) 194return invocation.TargetMethod.Parameters[0].Type as INamedTypeSymbol;
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (2)
75var targetMethod = invocation.TargetMethod; 284.Where(node => string.Equals(node.Identifier.Value as string, operation.TargetMethod.Name, StringComparison.Ordinal))
Microsoft.AspNetCore.Components.Analyzers (1)
InternalUsageAnalyzer.cs (1)
64IInvocationOperation invocation => invocation.TargetMethod,
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
InternalUsageAnalyzer.cs (1)
64IInvocationOperation invocation => invocation.TargetMethod,
Microsoft.AspNetCore.Http.RequestDelegateGenerator (2)
StaticRouteHandlerModel\InvocationOperationExtensions.cs (2)
30targetOperation.TargetMethod.ContainingNamespace is { Name: "Builder", ContainingNamespace: { Name: "AspNetCore", ContainingNamespace: { Name: "Microsoft", ContainingNamespace.IsGlobalNamespace: true } } } && 31targetOperation.TargetMethod.ContainingAssembly.Name is "Microsoft.AspNetCore.Routing" &&
Microsoft.AspNetCore.Mvc.Analyzers (6)
AvoidHtmlPartialAnalyzer.cs (1)
23var method = ((IInvocationOperation)context.Operation).TargetMethod;
src\Shared\Roslyn\CodeAnalysisExtensions.cs (4)
185else if (invocation.TargetMethod.IsExtensionMethod && !invocation.TargetMethod.Parameters.IsEmpty) 192else if (invocation.TargetMethod.Parameters[0].IsParams) 194return invocation.TargetMethod.Parameters[0].Type as INamedTypeSymbol;
TagHelpersInCodeBlocksAnalyzer.cs (1)
55if (!IsTagHelperRunnerRunAsync(invocationOperation.TargetMethod, symbolCache))
Microsoft.AspNetCore.Mvc.Api.Analyzers (5)
ActualApiResponseMetadataFactory.cs (1)
95defaultStatusCodeAttribute = invocationOperation.TargetMethod
src\Shared\Roslyn\CodeAnalysisExtensions.cs (4)
185else if (invocation.TargetMethod.IsExtensionMethod && !invocation.TargetMethod.Parameters.IsEmpty) 192else if (invocation.TargetMethod.Parameters[0].IsParams) 194return invocation.TargetMethod.Parameters[0].Type as INamedTypeSymbol;
Microsoft.CodeAnalysis (4)
Generated\Operations.Generated.cs (2)
778/// Type parameter which runtime type will be used to resolve virtual invocation of the <see cref="TargetMethod" />. 779/// Null if <see cref="TargetMethod" /> is resolved statically, or is an instance method.
Operations\ControlFlowGraphBuilder.cs (2)
5930IOperation? instance = operation.TargetMethod.IsStatic ? null : operation.Instance; 5933return new InvocationOperation(operation.TargetMethod, operation.ConstrainedToType, visitedInstance, operation.IsVirtual, visitedArguments, semanticModel: null, operation.Syntax,
Microsoft.CodeAnalysis.CodeStyle (18)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (1)
62var targetMethod = invocation.TargetMethod;
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (2)
112IInvocationOperation invocationOperation => invocationOperation.TargetMethod.Kind, 143IInvocationOperation invocationOperation => IsStaticMemberOrIsLocalFunctionHelper(invocationOperation.TargetMethod),
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
424var targetMethod = ((IInvocationOperation)operationContext.Operation).TargetMethod.OriginalDefinition;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (4)
81if (expression is IInvocationOperation { TargetMethod.Name: nameof(ToString) } invocation && 104if (IsObjectToStringOverride(invocation.TargetMethod) 166TargetMethod: { Name: nameof(FormattableString.Invariant), ContainingType: var containingType }, 199var targetName = invocation.TargetMethod.Name;
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (6)
178=> whereMethodSymbol.Equals(invocation.TargetMethod.ReducedFrom ?? invocation.TargetMethod.OriginalDefinition, SymbolEqualityComparer.Default); 181=> selectMethodSymbol.Equals(invocation.TargetMethod.ReducedFrom ?? invocation.TargetMethod.OriginalDefinition, SymbolEqualityComparer.Default); 184=> linqMethods.Any(static (m, invocation) => m.Equals(invocation.TargetMethod.ReducedFrom ?? invocation.TargetMethod.OriginalDefinition, SymbolEqualityComparer.Default), invocation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
259else if (invocation.TargetMethod.IsLocalFunction()) 261var localFunctionGraph = cfg.GetLocalFunctionControlFlowGraphInScope(invocation.TargetMethod.OriginalDefinition, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (2)
324switch (operation.TargetMethod.MethodKind) 340AnalyzeLocalFunctionInvocation(operation.TargetMethod);
Microsoft.CodeAnalysis.CSharp.CodeStyle (6)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
356return IsPotentiallyMutatingMethod(owningMethod, invocationOperation.Instance, invocationOperation.TargetMethod);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (1)
110invocationOperation.TargetMethod,
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (3)
119var targetMethod = invocation.TargetMethod; 145var targetMethod = invocation.TargetMethod; 341var refReturnMismatch = indexer.ReturnsByRef != invocation.TargetMethod.ReturnsByRef;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
1422if (operation is IInvocationOperation { TargetMethod.RefKind: not RefKind.Ref })
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (3)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (3)
45TargetMethod: IMethodSymbol { Name: nameof(Equals) }, 631TargetMethod.Name: nameof(Equals), 768TargetMethod.Name: nameof(Equals),
Microsoft.CodeAnalysis.CSharp.Features (8)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
356return IsPotentiallyMutatingMethod(owningMethod, invocationOperation.Instance, invocationOperation.TargetMethod);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (1)
110invocationOperation.TargetMethod,
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (3)
119var targetMethod = invocation.TargetMethod; 145var targetMethod = invocation.TargetMethod; 341var refReturnMismatch = indexer.ReturnsByRef != invocation.TargetMethod.ReturnsByRef;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (3)
45TargetMethod: IMethodSymbol { Name: nameof(Equals) }, 631TargetMethod.Name: nameof(Equals), 768TargetMethod.Name: nameof(Equals),
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
1422if (operation is IInvocationOperation { TargetMethod.RefKind: not RefKind.Ref })
Microsoft.CodeAnalysis.Features (14)
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
300var targetMethod = invocation.TargetMethod;
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (1)
62var targetMethod = invocation.TargetMethod;
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (2)
112IInvocationOperation invocationOperation => invocationOperation.TargetMethod.Kind, 143IInvocationOperation invocationOperation => IsStaticMemberOrIsLocalFunctionHelper(invocationOperation.TargetMethod),
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
424var targetMethod = ((IInvocationOperation)operationContext.Operation).TargetMethod.OriginalDefinition;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (4)
81if (expression is IInvocationOperation { TargetMethod.Name: nameof(ToString) } invocation && 104if (IsObjectToStringOverride(invocation.TargetMethod) 166TargetMethod: { Name: nameof(FormattableString.Invariant), ContainingType: var containingType }, 199var targetName = invocation.TargetMethod.Name;
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (4)
178=> whereMethodSymbol.Equals(invocation.TargetMethod.ReducedFrom ?? invocation.TargetMethod.OriginalDefinition, SymbolEqualityComparer.Default); 181=> selectMethodSymbol.Equals(invocation.TargetMethod.ReducedFrom ?? invocation.TargetMethod.OriginalDefinition, SymbolEqualityComparer.Default);
ValueTracking\ValueTracker.OperationCollector.cs (1)
106await AddOperationAsync(invocationOperation, invocationOperation.TargetMethod, cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.Test.Utilities (9)
Compilation\ControlFlowGraphVerifier.cs (2)
934TargetMethod: { Name: BoundInterpolatedString.AppendFormattedMethod or BoundInterpolatedString.AppendLiteralMethod, ContainingType: INamedTypeSymbol containingType } 1730method = invocation.TargetMethod;
Compilation\OperationTreeVerifier.cs (2)
826LogSymbol(operation.TargetMethod, header: string.Empty); 1046Assert.False(invocation.TargetMethod.IsStatic);
Compilation\TestOperationVisitor.cs (3)
532Assert.NotNull(operation.TargetMethod); 535AssertConstrainedToType(operation.TargetMethod, operation.ConstrainedToType); 555if (operation.TargetMethod.IsStatic &&
Diagnostics\BoxingOperationAnalyzer.cs (1)
64invocation.TargetMethod.ContainingType.IsReferenceType)
Diagnostics\OperationTestAnalyzer.cs (1)
1400memberSymbol = ((IInvocationOperation)operation).TargetMethod;
Microsoft.CodeAnalysis.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
259else if (invocation.TargetMethod.IsLocalFunction()) 261var localFunctionGraph = cfg.GetLocalFunctionControlFlowGraphInScope(invocation.TargetMethod.OriginalDefinition, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (2)
324switch (operation.TargetMethod.MethodKind) 340AnalyzeLocalFunctionInvocation(operation.TargetMethod);
Microsoft.Interop.ComInterfaceGenerator (5)
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (4)
108if (methodsOfInterest.TryGetValue(operation.TargetMethod.OriginalDefinition, out ImmutableArray<Func<IInvocationOperation, (ITypeSymbol, Location)?>> discoverers)) 123operation.TargetMethod.ToMinimalDisplayString(operation.SemanticModel, operation.Syntax.SpanStart), 186else if (operand is IInvocationOperation invocation && invocation.TargetMethod.Equals(getObjectForIUnknown, SymbolEqualityComparer.Default)) 208var type = invocation.TargetMethod.TypeArguments[ordinal];
src\libraries\System.Runtime.InteropServices\gen\Common\OperationExtensions.cs (1)
14if (operation.TargetMethod.Parameters.Length <= ordinal)
Microsoft.Interop.LibraryImportGenerator (1)
src\libraries\System.Runtime.InteropServices\gen\Common\OperationExtensions.cs (1)
14if (operation.TargetMethod.Parameters.Length <= ordinal)
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
src\libraries\System.Runtime.InteropServices\gen\Common\OperationExtensions.cs (1)
14if (operation.TargetMethod.Parameters.Length <= ordinal)
Microsoft.VisualStudio.LanguageServices (2)
PullMemberUp\SymbolDependentsBuilder.cs (2)
82_membersInType.Contains(methodReferenceOp.TargetMethod)) 84_dependents.Add(methodReferenceOp.TargetMethod);
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
193IInvocationOperation iOperation => iOperation.TargetMethod,
System.Text.RegularExpressions.Generator (2)
UpgradeToGeneratedRegexAnalyzer.cs (1)
94IMethodSymbol method = invocationOperation.TargetMethod;
UpgradeToGeneratedRegexCodeFixer.cs (1)
169replacement = generator.InvocationExpression(generator.MemberAccessExpression(replacement, invocationOperation.TargetMethod.Name), arguments);