本文整理汇总了C#中ILog.LogWarning方法的典型用法代码示例。如果您正苦于以下问题:C# ILog.LogWarning方法的具体用法?C# ILog.LogWarning怎么用?C# ILog.LogWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILog
的用法示例。
在下文中一共展示了ILog.LogWarning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveNode
public ResolveResult ResolveNode(AstNode node, ILog log)
{
var syntaxTree = node.GetParent<SyntaxTree>();
this.InitResolver(syntaxTree);
var result = this.resolver.Resolve(node);
if (result is MethodGroupResolveResult && node.Parent != null)
{
var methodGroupResolveResult = (MethodGroupResolveResult)result;
var parentResolveResult = this.ResolveNode(node.Parent, log);
var parentInvocation = parentResolveResult as InvocationResolveResult;
IParameterizedMember method = methodGroupResolveResult.Methods.LastOrDefault();
bool isInvocation = node.Parent is InvocationExpression && (((InvocationExpression)(node.Parent)).Target == node);
if (node is Expression)
{
var conversion = this.Resolver.GetConversion((Expression)node);
if (conversion != null && conversion.IsMethodGroupConversion)
{
return new MemberResolveResult(new TypeResolveResult(conversion.Method.DeclaringType), conversion.Method);
}
}
if (isInvocation && parentInvocation != null)
{
var or = methodGroupResolveResult.PerformOverloadResolution(this.compilation, parentInvocation.GetArgumentsForCall().ToArray());
if (or.FoundApplicableCandidate)
{
method = or.BestCandidate;
return new MemberResolveResult(new TypeResolveResult(method.DeclaringType), method);
}
}
if (parentInvocation != null && method == null)
{
var typeDef = methodGroupResolveResult.TargetType as DefaultResolvedTypeDefinition;
if (typeDef != null)
{
var methods = typeDef.Methods.Where(m => m.Name == methodGroupResolveResult.MethodName);
method = methods.FirstOrDefault();
}
}
if (method == null)
{
var extMethods = methodGroupResolveResult.GetEligibleExtensionMethods(false);
if (!extMethods.Any())
{
extMethods = methodGroupResolveResult.GetExtensionMethods();
}
if (!extMethods.Any() || !extMethods.First().Any())
{
throw new EmitterException(node, "Cannot find method defintion");
}
method = extMethods.First().First();
}
if (parentInvocation == null || method.FullName != parentInvocation.Member.FullName)
{
MemberResolveResult memberResolveResult = new MemberResolveResult(new TypeResolveResult(method.DeclaringType), method);
return memberResolveResult;
}
return parentResolveResult;
}
if ((result == null || result.IsError) && log != null)
{
if (result is CSharpInvocationResolveResult && ((CSharpInvocationResolveResult)result).OverloadResolutionErrors != OverloadResolutionErrors.None)
{
return result;
}
log.LogWarning(string.Format("Node resolving has failed {0}: {1}", node.StartLocation, node.ToString()));
}
return result;
}