예제 #1
0
        internal DiagnosticDescriptor(
            string id,
            LocalizableString title,
            LocalizableString messageFormat,
            string category,
            DiagnosticSeverity defaultSeverity,
            bool isEnabledByDefault,
            LocalizableString description,
            string helpLinkUri,
            ImmutableArray <string> customTags)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentException(CodeAnalysisResources.DiagnosticIdCantBeNullOrWhitespace, nameof(id));
            }

            if (messageFormat == null)
            {
                throw new ArgumentNullException(nameof(messageFormat));
            }

            if (category == null)
            {
                throw new ArgumentNullException(nameof(category));
            }

            if (title == null)
            {
                throw new ArgumentNullException(nameof(title));
            }

            this.Id                 = id;
            this.Title              = title.MakeExceptionSafe();
            this.Category           = category;
            this.MessageFormat      = messageFormat.MakeExceptionSafe();
            this.DefaultSeverity    = defaultSeverity;
            this.IsEnabledByDefault = isEnabledByDefault;
            this.Description        = (description ?? string.Empty).MakeExceptionSafe();
            this.HelpLinkUri        = helpLinkUri ?? string.Empty;
            this.CustomTags         = customTags.AsImmutableOrEmpty();
        }