public static RuntimeConditions LogUnhandledRuleExceptionAnalyzingTarget( HashSet <string> disabledSkimmers, TContext context, ISkimmer <TContext> skimmer, Exception ex) { string ruleName = context.Rule.Name; context.Rule = ErrorDescriptors.RuleDisabled; // An unhandled exception was encountered analyzing '{0}' for check '{1}', // which has been disabled for the remainder of the analysis.The // exception may have resulted from a problem related to parsing // image metadata and not specific to the rule, however. // Exception information: // {2} context.Logger.Log(ResultKind.InternalError, context, null, nameof(SdkResources.ERR0998_ExceptionInAnalyze), Path.GetFileName(context.TargetUri.LocalPath), ruleName, ex.ToString()); if (disabledSkimmers != null) { disabledSkimmers.Add(skimmer.Id); } return(RuntimeConditions.ExceptionInSkimmerAnalyze); }
public static RuntimeConditions LogUnhandledRuleExceptionAssessingTargetApplicability( HashSet <string> disabledSkimmers, TContext context, ISkimmer <TContext> skimmer, Exception ex) { string ruleName = context.Rule.Name; context.Rule = ErrorDescriptors.RuleDisabled; // An unhandled exception was raised attempting to determine whether '{0}' // is a valid analysis target for check '{1}' (which has been disabled // for the remainder of the analysis). The exception may have resulted // from a problem related to parsing image metadata and not specific to // the rule, however. Exception information: // {2} context.Logger.Log(ResultKind.InternalError, context, null, nameof(SdkResources.ERR0998_ExceptionInCanAnalyze), context.TargetUri.LocalPath, ruleName, ex.ToString()); if (disabledSkimmers != null) { disabledSkimmers.Add(skimmer.Id); } return(RuntimeConditions.ExceptionRaisedInSkimmerCanAnalyze); }
private void LogUnhandledExceptionInitializingRule(TContext context, ISkimmer <TContext> skimmer, Exception ex) { string ruleName = context.Rule.Name; // An unhandled exception was encountered initializing check '{0}', which // has been disabled for the remainder of the analysis. Exception information: // {1} context.Rule = ErrorDescriptors.UnhandledRuleException; context.Logger.Log(ResultKind.InternalError, context, string.Format(SdkResources.ExceptionInitializingRule, ruleName, ex.ToString())); RuntimeErrors |= RuntimeConditions.ExceptionInSkimmerInitialize; }
protected void LogUnhandledExceptionInitializingRule(TContext context, ISkimmer <TContext> skimmer, Exception ex) { string ruleName = context.Rule.Name; // An unhandled exception was encountered initializing check '{0}', which // has been disabled for the remainder of the analysis. Exception information: // {1} var errorContext = new TContext(); errorContext.Rule = ErrorDescriptors.RuleDisabled; context.Logger.Log(ResultKind.InternalError, errorContext, null, nameof(SdkResources.ERR0998_ExceptionInInitialize), ruleName, ex.ToString()); RuntimeErrors |= RuntimeConditions.ExceptionInSkimmerInitialize; }