Exemplo n.º 1
0
        private string TryGetAnnotationLocation(
            [NotNull] Summary summary,
            [NotNull] IMessageLogger messageLogger)
        {
            var benchmarkType  = summary.Benchmarks[0].Target.Type;
            var sameTypeTarget = summary.GetExecutionOrderBenchmarks()
                                 .Select(b => b.Target)
                                 .FirstOrDefault(t => t.Method.DeclaringType == benchmarkType);

            if (sameTypeTarget == null)
            {
                messageLogger.WriteSetupErrorMessage(
                    $"Cannot find source file location as {benchmarkType.Name} has no benchmark methods in it. ",
                    $"Add a benchmark method to the type {benchmarkType.FullName}.");

                return(null);
            }

            var sourcePath = SymbolHelper.TryGetSourcePath(sameTypeTarget, messageLogger);

            if (sourcePath == null)
            {
                return(null);
            }

            return(GetResourcePath(sourcePath, ResourcePath));
        }
Exemplo n.º 2
0
 private static string TryGetAnnotationLocation(
     [NotNull] CompetitionTarget targetToAnnotate,
     [NotNull] IMessageLogger messageLogger) =>
 SymbolHelper.TryGetSourcePath(targetToAnnotate.Target, messageLogger);