本文整理汇总了C#中Compilation.GetRepoAndTrees方法的典型用法代码示例。如果您正苦于以下问题:C# Compilation.GetRepoAndTrees方法的具体用法?C# Compilation.GetRepoAndTrees怎么用?C# Compilation.GetRepoAndTrees使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Compilation
的用法示例。
在下文中一共展示了Compilation.GetRepoAndTrees方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCompilationAsync
private async static Task<IEnumerable<Diagnostic>> OnCompilationAsync(Compilation comp)
{
Logger.Trace($"Entering {nameof(OnCompilationAsync)}: {comp.AssemblyName}");
try
{
var data = comp.GetRepoAndTrees(GetRepo);
foreach (var repo in data.Keys)
{
try
{
await repo.UpdateRemoteChangesAsync();
}
catch (GitHubAuthenticationFailureException ex)
{
return new[] { Diagnostics.AuthenticationFailure(ex.GithubMessage) };
}
catch (GitHubRateLimitExceededException ex)
{
return new[] { Diagnostics.RateLimit(ex.Limit, ex.Authenticated) };
}
catch (GitHubUrlNotFoundException ex)
{
return new[] { Diagnostics.NotGitHubRepo(ex.Path) };
}
catch (GitHubUnknownErrorException ex)
{
return new[] { Diagnostics.UnexpectedError($"Communicating with GitHub", ex.Message) };
}
catch (GitHubDeserializationException ex)
{
return new[] { Diagnostics.UnexpectedError($"Deserializing Data", ex.Message) };
}
catch (Exception ex)
{
Logger.Error($"Unhandled Exception from {nameof(repo.UpdateRemoteChangesAsync)}: {ex.GetType().Name}: {ex.Message} << {ex.StackTrace} >>");
return new[] { Diagnostics.UnexpectedError($"Communicating with GitHub", ex.Message) };
}
}
var diagnostics = new List<Diagnostic>();
foreach (var rt in data)
{
var repo = rt.Key;
foreach (var t in rt.Value) //Foreach tree
{
diagnostics.AddRange(Analyze(comp.GetSemanticModel(t), repo));
}
}
return diagnostics;
}
catch (Exception ex)
{
Logger.Error($"Unhandled Exception: {ex.GetType().Name}: {ex.Message} << {ex.StackTrace} >>");
return new[] { Diagnostics.UnexpectedError("Running Analysis", ex.Message) };
}
finally
{
Logger.Trace($"Entering {nameof(OnCompilationAsync)}: {comp.AssemblyName}");
}
}