public override void VisitInvocationExpression(InvocationExpressionSyntax node) { var symbol = (IMethodSymbol)SemanticModel.GetSymbolInfo(node).Symbol; if (symbol != null) { IsAsyncLibraryConstruct(symbol.OriginalDefinition); if (symbol.IsAPMBeginMethod()) { Logs.TempLog.Info(SourceFile.FilePath + "\n" + node + "\n" + symbol + "\n"+ node.FirstAncestorOrSelf<MethodDeclarationSyntax>() + "******************\n"); Result.APM++; } else if (node.IsEAPMethod()) { Result.EAP++; } else if (symbol.IsTAPMethod()) { // printing TAP methods: Logs.TempLog.Info(SourceFile.FilePath + "\n" + node + "\n" + symbol + "******************\n"); Result.TAP++; } else if (symbol.IsThreadStart()) { Result.ThreadInit++; } else if (symbol.IsThreadPoolQueueUserWorkItem()) { Result.ThreadPoolQueue++; } else if (symbol.IsBackgroundWorkerMethod()) { Result.BackgroundWorker++; } else if (symbol.IsAsyncDelegate()) { Result.AsyncDelegate++; } else if (symbol.IsTaskCreationMethod()) { Result.TaskInit++; } else if (symbol.IsParallelFor()) { Result.ParallelFor++; } else if (symbol.IsParallelForEach()) { Result.ParallelForEach++; } else if (symbol.IsParallelInvoke()) { Result.ParallelInvoke++; } } base.VisitInvocationExpression(node); }
private Enums.AsyncDetected DetectAsynchronousUsages(InvocationExpressionSyntax methodCall, IMethodSymbol methodCallSymbol) { var methodCallName = methodCall.Expression.ToString().ToLower(); // DETECT ASYNC CALLS if (methodCallSymbol.IsThreadStart()) return Enums.AsyncDetected.Thread; else if (methodCallSymbol.IsThreadPoolQueueUserWorkItem()) return Enums.AsyncDetected.Threadpool; else if (methodCallSymbol.IsAsyncDelegate()) return Enums.AsyncDetected.AsyncDelegate; else if (methodCallSymbol.IsBackgroundWorkerMethod()) return Enums.AsyncDetected.BackgroundWorker; else if (methodCallSymbol.IsTaskCreationMethod()) return Enums.AsyncDetected.Task; //// DETECT GUI UPDATE CALLS //else if (methodCallSymbol.IsISynchronizeInvokeMethod()) // return Enums.AsyncDetected.ISynchronizeInvoke; //else if (methodCallSymbol.IsControlBeginInvoke()) // return Enums.AsyncDetected.ControlInvoke; //else if (methodCallSymbol.IsDispatcherBeginInvoke()) // return Enums.AsyncDetected.Dispatcher; // DETECT PATTERNS else if (methodCallSymbol.IsAPMBeginMethod()) return Enums.AsyncDetected.APM; else if (methodCall.IsEAPMethod()) return Enums.AsyncDetected.EAP; else if (methodCallSymbol.IsTAPMethod()) return Enums.AsyncDetected.TAP; else return Enums.AsyncDetected.None; }
private Enums.AsyncDetected DetectIOAsynchronousUsages(InvocationExpressionSyntax methodCall, IMethodSymbol methodCallSymbol) { var methodCallName = methodCall.Expression.ToString().ToLower(); // DETECT PATTERNS if (methodCallSymbol.IsAPMBeginMethod()) return Enums.AsyncDetected.APM; else if (methodCall.IsEAPMethod()) return Enums.AsyncDetected.EAP; else if (methodCallSymbol.IsTAPMethod()) return Enums.AsyncDetected.TAP; else return Enums.AsyncDetected.None; }