Microsoft.CodeAnalysis.Sarif.Errors.LogUnhandledRuleExceptionAssessingTargetApplicability C# (CSharp) Method

LogUnhandledRuleExceptionAssessingTargetApplicability() public static method

public static LogUnhandledRuleExceptionAssessingTargetApplicability ( HashSet disabledSkimmers, IAnalysisContext context, Exception exception ) : void
disabledSkimmers HashSet
context IAnalysisContext
exception System.Exception
return void
        public static void LogUnhandledRuleExceptionAssessingTargetApplicability(
            HashSet<string> disabledSkimmers,
            IAnalysisContext context,
            Exception exception)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            // 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.
            context.Logger.LogToolNotification(
                CreateNotification(
                    context.TargetUri,
                    ERR998_ExceptionInCanAnalyze,
                    context.Rule.Id,
                    NotificationLevel.Error,
                    exception,
                    true,
                    context.TargetUri.GetFileName(),
                    context.Rule.Name));

            if (disabledSkimmers != null) { disabledSkimmers.Add(context.Rule.Id); }

            context.RuntimeErrors |= RuntimeConditions.ExceptionRaisedInSkimmerCanAnalyze;
        }