• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ReportDiagnostic类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ReportDiagnostic的典型用法代码示例。如果您正苦于以下问题:C# ReportDiagnostic类的具体用法?C# ReportDiagnostic怎么用?C# ReportDiagnostic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReportDiagnostic类属于命名空间,在下文中一共展示了ReportDiagnostic类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: WithEffectiveAction

        /// <summary>
        /// Create a RuleSet with a global effective action applied on it.
        /// </summary>
        public RuleSet WithEffectiveAction(ReportDiagnostic action)
        {
            if (!_includes.IsEmpty)
            {
                throw new ArgumentException("Effective action cannot be applied to rulesets with Includes");
            }

            switch (action)
            {
                case ReportDiagnostic.Default:
                    return this;
                case ReportDiagnostic.Suppress:
                    return null;
                case ReportDiagnostic.Error:
                case ReportDiagnostic.Warn:
                case ReportDiagnostic.Info:
                case ReportDiagnostic.Hidden:
                    var generalOption = _generalDiagnosticOption == ReportDiagnostic.Default ? ReportDiagnostic.Default : action;
                    var specificOptions = _specificDiagnosticOptions.ToBuilder();
                    foreach (var item in _specificDiagnosticOptions)
                    {
                        if (item.Value != ReportDiagnostic.Suppress && item.Value != ReportDiagnostic.Default)
                        {
                            specificOptions[item.Key] = action;
                        }
                    }
                    return new RuleSet(FilePath, generalOption, specificOptions.ToImmutable(), _includes);
                default:
                    return null;
            }
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:34,代码来源:RuleSet.cs


示例2: DiagnosticItem

 public DiagnosticItem(AnalyzerItem analyzerItem, DiagnosticDescriptor descriptor, ReportDiagnostic effectiveSeverity)
     : base(string.Format("{0}: {1}", descriptor.Id, descriptor.Title))
 {
     _analyzerItem = analyzerItem;
     _descriptor = descriptor;
     _effectiveSeverity = effectiveSeverity;
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:7,代码来源:DiagnosticItem.cs


示例3: RuleSet

 /// <summary>
 /// Create a RuleSet.
 /// </summary>
 public RuleSet(string filePath, ReportDiagnostic generalOption, ImmutableDictionary<string, ReportDiagnostic> specificOptions, ImmutableArray<RuleSetInclude> includes)
 {
     _filePath = filePath;
     _generalDiagnosticOption = generalOption;
     _specificDiagnosticOptions = specificOptions == null ? ImmutableDictionary<string, ReportDiagnostic>.Empty : specificOptions;
     _includes = includes.IsDefault ? ImmutableArray<RuleSetInclude>.Empty : includes;
 }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:10,代码来源:RuleSet.cs


示例4: RuleSet

 /// <summary>
 /// Create a RuleSet.
 /// </summary>
 public RuleSet(string filePath, ReportDiagnostic generalOption, IDictionary<string, ReportDiagnostic> specificOptions, IEnumerable<RuleSetInclude> includes)
 {
     this.filePath = filePath;
     this.generalDiagnosticOption = generalOption;
     this.specificDiagnosticOptions = specificOptions == null ? ImmutableDictionary<string, ReportDiagnostic>.Empty : specificOptions.ToImmutableDictionary();
     this.includes = includes == null ? ImmutableArray<RuleSetInclude>.Empty : includes.ToImmutableArray();
 }
开发者ID:pheede,项目名称:roslyn,代码行数:10,代码来源:RuleSet.cs


示例5: GetDiagnosticReport

        // Take a warning and return the final deposition of the given warning,
        // based on both command line options and pragmas.
        // If you update this method, also update DiagnosticItemSource.GetEffectiveSeverity. 
        internal static ReportDiagnostic GetDiagnosticReport(DiagnosticSeverity severity, bool isEnabledByDefault, string id, int diagnosticWarningLevel, Location location, string category, int warningLevelOption, ReportDiagnostic generalDiagnosticOption, IDictionary<string, ReportDiagnostic> specificDiagnosticOptions)
        {
            // Read options (e.g., /nowarn or /warnaserror)
            ReportDiagnostic report = ReportDiagnostic.Default;
            var isSpecified = specificDiagnosticOptions.TryGetValue(id, out report);
            if (!isSpecified)
            {
                report = isEnabledByDefault ? ReportDiagnostic.Default : ReportDiagnostic.Suppress;
            }

            // Compute if the reporting should be suppressed.
            if (diagnosticWarningLevel > warningLevelOption  // honor the warning level
                || report == ReportDiagnostic.Suppress)                // check options (/nowarn)
            {
                return ReportDiagnostic.Suppress;
            }

            // If location is available, check out pragmas
            if (location != null &&
                location.SourceTree != null &&
                ((SyntaxTree)location.SourceTree).GetPragmaDirectiveWarningState(id, location.SourceSpan.Start) == ReportDiagnostic.Suppress)
            {
                return ReportDiagnostic.Suppress;
            }

            // Unless specific warning options are defined (/warnaserror[+|-]:<n> or /nowarn:<n>, 
            // follow the global option (/warnaserror[+|-] or /nowarn).
            if (report == ReportDiagnostic.Default)
            {
                switch (generalDiagnosticOption)
                {
                    case ReportDiagnostic.Error:
                        // If we've been asked to do warn-as-error then don't raise severity for anything below warning (info or hidden).
                        if (severity == DiagnosticSeverity.Warning)
                        {
                            // In the case where /warnaserror+ is followed by /warnaserror-:<n> on the command line,
                            // do not promote the warning specified in <n> to an error.
                            if (!isSpecified && (report == ReportDiagnostic.Default))
                            {
                                return ReportDiagnostic.Error;
                            }
                        }
                        break;
                    case ReportDiagnostic.Suppress:
                        // When doing suppress-all-warnings, don't lower severity for anything other than warning and info.
                        // We shouldn't suppress hidden diagnostics here because then features that use hidden diagnostics to
                        // display a lightbulb would stop working if someone has suppress-all-warnings (/nowarn) specified in their project.
                        if (severity == DiagnosticSeverity.Warning || severity == DiagnosticSeverity.Info)
                        {
                            return ReportDiagnostic.Suppress;
                        }
                        break;
                    default:
                        break;
                }
            }

            return report;
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:62,代码来源:CSharpDiagnosticFilter.cs


示例6: DiagnosticItem

 public DiagnosticItem(AnalyzerItem analyzerItem, DiagnosticDescriptor descriptor, ReportDiagnostic effectiveSeverity, IContextMenuController contextMenuController)
     : base(string.Format("{0}: {1}", descriptor.Id, descriptor.Title))
 {
     _analyzerItem = analyzerItem;
     _descriptor = descriptor;
     _effectiveSeverity = effectiveSeverity;
     _contextMenuController = contextMenuController;
 }
开发者ID:nemec,项目名称:roslyn,代码行数:8,代码来源:DiagnosticItem.cs


示例7: UpdateEffectiveSeverity

        internal void UpdateEffectiveSeverity(ReportDiagnostic newEffectiveSeverity)
        {
            if (_effectiveSeverity != newEffectiveSeverity)
            {
                _effectiveSeverity = newEffectiveSeverity;

                NotifyPropertyChanged(nameof(EffectiveSeverity));
                NotifyPropertyChanged(nameof(IconMoniker));
            }
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:10,代码来源:DiagnosticItem.cs


示例8: Filter

        /// <summary>
        /// Modifies an input <see cref="Diagnostic"/> per the given options. For example, the
        /// severity may be escalated, or the <see cref="Diagnostic"/> may be filtered out entirely
        /// (by returning null).
        /// </summary>
        /// <param name="d">The input diagnostic</param>
        /// <param name="warningLevelOption">The maximum warning level to allow. Diagnostics with a higher warning level will be filtered out.</param>
        /// <param name="generalDiagnosticOption">How warning diagnostics should be reported</param>
        /// <param name="specificDiagnosticOptions">How specific diagnostics should be reported</param>
        /// <returns>A diagnostic updated to reflect the options, or null if it has been filtered out</returns>
        public static Diagnostic Filter(Diagnostic d, int warningLevelOption, ReportDiagnostic generalDiagnosticOption, IDictionary<string, ReportDiagnostic> specificDiagnosticOptions)
        {
            if (d == null)
            {
                return d;
            }
            else if (d.IsNotConfigurable())
            {
                if (d.IsEnabledByDefault)
                {
                    // Enabled NotConfigurable should always be reported as it is.
                    return d;
                }
                else
                {
                    // Disabled NotConfigurable should never be reported.
                    return null;
                }
            }
            else if (d.Severity == InternalDiagnosticSeverity.Void)
            {
                return null;
            }

            //In the native compiler, all warnings originating from alink.dll were issued
            //under the id WRN_ALinkWarn - 1607. If a customer used nowarn:1607 they would get
            //none of those warnings. In Roslyn, we've given each of these warnings their
            //own number, so that they may be configured independently. To preserve compatibility
            //if a user has specifically configured 1607 and we are reporting one of the alink warnings, use
            //the configuration specified for 1607. As implemented, this could result in customers 
            //specifying warnaserror:1607 and getting a message saying "warning as error CS8012..."
            //We don't permit configuring 1607 and independently configuring the new warnings.
            ReportDiagnostic reportAction;
            if (s_alinkWarnings.Contains((ErrorCode)d.Code) &&
                specificDiagnosticOptions.Keys.Contains(CSharp.MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_ALinkWarn)))
            {
                reportAction = GetDiagnosticReport(ErrorFacts.GetSeverity(ErrorCode.WRN_ALinkWarn),
                    d.IsEnabledByDefault,
                    CSharp.MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_ALinkWarn),
                    ErrorFacts.GetWarningLevel(ErrorCode.WRN_ALinkWarn),
                    d.Location as Location,
                    d.Category,
                    warningLevelOption,
                    generalDiagnosticOption,
                    specificDiagnosticOptions);
            }
            else
            {
                reportAction = GetDiagnosticReport(d.Severity, d.IsEnabledByDefault, d.Id, d.WarningLevel, d.Location as Location, d.Category, warningLevelOption, generalDiagnosticOption, specificDiagnosticOptions);
            }

            return d.WithReportDiagnostic(reportAction);
        }
开发者ID:anshita-arya,项目名称:roslyn,代码行数:63,代码来源:CSharpDiagnosticFilter.cs


示例9: Filter

        /// <summary>
        /// Modifies an input <see cref="Diagnostic"/> per the given options. For example, the
        /// severity may be escalated, or the <see cref="Diagnostic"/> may be filtered out entirely
        /// (by returning null).
        /// </summary>
        /// <param name="d">The input diagnostic</param>
        /// <param name="warningLevelOption">The maximum warning level to allow. Diagnostics with a higher warning level will be filtered out.</param>
        /// <param name="generalDiagnosticOption">How warning diagnostics should be reported</param>
        /// <param name="specificDiagnosticOptions">How specific diagnostics should be reported</param>
        /// <returns>A diagnostic updated to reflect the options, or null if it has been filtered out</returns>
        public static Diagnostic Filter(Diagnostic d, int warningLevelOption, ReportDiagnostic generalDiagnosticOption, IDictionary<string, ReportDiagnostic> specificDiagnosticOptions)
        {
            if (d == null) return d;
            switch (d.Severity)
            {
                case DiagnosticSeverity.Error:
                    // If it is a compiler error, keep it as it is.
                    // TODO: We currently use .Category to detect whether the diagnostic is a compiler diagnostic.
                    // Perhaps there should be a stronger way of checking this that avoids the possibility of an
                    // inadvertent clash for some custom diagnostic that happens to use the same category string.
                    if (d.Category == Diagnostic.CompilerDiagnosticCategory)
                    {
                        return d;
                    }
                    break;
                case InternalDiagnosticSeverity.Void:
                    return null;
                default:
                    break;
            }

            //In the native compiler, all warnings originating from alink.dll were issued
            //under the id WRN_ALinkWarn - 1607. If a customer used nowarn:1607 they would get
            //none of those warnings. In Roslyn, we've given each of these warnings their
            //own number, so that they may be configured independently. To preserve compatibility
            //if a user has specifically configured 1607 and we are reporting one of the alink warnings, use
            //the configuration specified for 1607. As implemented, this could result in customers 
            //specifying warnaserror:1607 and getting a message saying "warning as error CS8012..."
            //We don't permit configuring 1607 and independently configuring the new warnings.
            ReportDiagnostic reportAction;
            if (AlinkWarnings.Contains((ErrorCode)d.Code) &&
                specificDiagnosticOptions.Keys.Contains(CSharp.MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_ALinkWarn)))
            {
                reportAction = GetDiagnosticReport(ErrorFacts.GetSeverity(ErrorCode.WRN_ALinkWarn),
                    d.IsEnabledByDefault,
                    CSharp.MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_ALinkWarn),
                    ErrorFacts.GetWarningLevel(ErrorCode.WRN_ALinkWarn),
                    d.Location as Location,
                    d.Category,
                    warningLevelOption,
                    generalDiagnosticOption,
                    specificDiagnosticOptions);
            }
            else
            {
                reportAction = GetDiagnosticReport(d.Severity, d.IsEnabledByDefault, d.Id, d.WarningLevel, d.Location as Location, d.Category, warningLevelOption, generalDiagnosticOption, specificDiagnosticOptions);
            }

            return d.WithReportDiagnostic(reportAction);
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:60,代码来源:CSharpDiagnosticFilter.cs


示例10: ConvertReportDiagnosticToAction

 private static string ConvertReportDiagnosticToAction(ReportDiagnostic value)
 {
     switch (value)
     {
         case ReportDiagnostic.Default:
             return "Default";
         case ReportDiagnostic.Error:
             return "Error";
         case ReportDiagnostic.Warn:
             return "Warning";
         case ReportDiagnostic.Info:
             return "Info";
         case ReportDiagnostic.Hidden:
             return "Hidden";
         case ReportDiagnostic.Suppress:
             return "None";
         default:
             throw ExceptionUtilities.Unreachable;
     }
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:20,代码来源:RuleSetDocumentExtensions.cs


示例11: SetSeverity

        internal static void SetSeverity(this XDocument ruleSet, string analyzerId, string ruleId, ReportDiagnostic value)
        {
            var newAction = ConvertReportDiagnosticToAction(value);

            var rules = FindOrCreateRulesElement(ruleSet, analyzerId);
            var rule = FindOrCreateRuleElement(rules, ruleId);

            if (value == ReportDiagnostic.Default)
            {
                // If the new severity is 'Default' we just delete the entry for the rule from the ruleset file.
                // In the absence of an explicit entry in the ruleset file, the rule reverts back to its 'Default'
                // severity (so far as the 'current' ruleset file is concerned - the rule's effective severity
                // could still be decided by other factors such as project settings or a base ruleset file).
                rule.Remove();
            }
            else
            {
                rule.Attribute("Action").Value = newAction;
            }

            var allMatchingRules = ruleSet.Root
                                       .Descendants("Rule")
                                       .Where(r => r.Attribute("Id").Value.Equals(ruleId))
                                       .ToList();

            foreach (var matchingRule in allMatchingRules)
            {
                if (value == ReportDiagnostic.Default)
                {
                    // If the new severity is 'Default' we just delete the entry for the rule from the ruleset file.
                    // In the absence of an explicit entry in the ruleset file, the rule reverts back to its 'Default'
                    // severity (so far as the 'current' ruleset file is concerned - the rule's effective severity
                    // could still be decided by other factors such as project settings or a base ruleset file).
                    matchingRule.Remove();
                }
                else
                {
                    matchingRule.Attribute("Action").Value = newAction;
                }
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:41,代码来源:RuleSetDocumentExtensions.cs


示例12: CSharpProject

 public CSharpProject(string projectFile)
 {
     if (!File.Exists(projectFile))
         throw new Exception(string.Format("project file not found \"{0}\"", projectFile));
     WriteLine(1, "compile project \"{0}\"", projectFile);
     _projectFile = projectFile;
     _projectDirectory = Path.GetDirectoryName(projectFile);
     _projectDocument = XDocument.Load(projectFile);
     _frameworkDirectory = GetValue("FrameworkDirectory");
     WriteLine(2, "  framework directory               : \"{0}\"", _frameworkDirectory);
     _assemblyName = GetValue("AssemblyName");
     WriteLine(2, "  assembly name                     : \"{0}\"", _assemblyName);
     string outputDirectory = PathCombine(_projectDirectory, GetValue("OutputDirectory"));
     WriteLine(2, "  output directory                  : \"{0}\"", outputDirectory);
     _languageVersion = GetLanguageVersion(GetValue("LanguageVersion"));
     WriteLine(2, "  language version                  : \"{0}\"", _languageVersion);
     _outputKind = GetOutputKind(GetValue("OutputKind"));
     WriteLine(2, "  output kind                       : \"{0}\"", _outputKind);
     _optimizationLevel = GetOptimizationLevel(GetValue("OptimizationLevel"));
     WriteLine(2, "  optimization level                : \"{0}\"", _optimizationLevel);
     _platform = GetPlatform(GetValue("Platform"));
     WriteLine(2, "  platform                          : \"{0}\"", _platform);
     _generalDiagnosticOption = ReportDiagnostic.Default;
     WriteLine(2, "  general diagnostic option         : \"{0}\"", _generalDiagnosticOption);
     _warningLevel = 4;
     WriteLine(2, "  warning level                     : \"{0}\"", _warningLevel);
     _outputPath = PathCombine(outputDirectory, GetValue("OutputPath"));
     WriteLine(2, "  output path                       : \"{0}\"", _outputPath);
     _pdbPath = PathCombine(outputDirectory, GetValue("PdbPath"));
     WriteLine(2, "  pdb path                          : \"{0}\"", _pdbPath);
     _win32ResourceFile = PathCombine(_projectDirectory, GetValue("Win32ResourceFile"));
     WriteLine(2, "  win32 resource file               : \"{0}\"", _win32ResourceFile);
     _preprocessorSymbols = GetPreprocessorSymbols();
     _sourceFiles = GetSources();
     _resourceFiles = GetResourceFiles();
     _assembliesFiles = GetAssembliesFiles();
 }
开发者ID:labeuze,项目名称:source,代码行数:37,代码来源:CSharpProject.cs


示例13: RuleSetInclude

 /// <summary>
 /// Create a RuleSetInclude given the includepath and the effective action.
 /// </summary>
 public RuleSetInclude(string includePath, ReportDiagnostic action)
 {
     _includePath = includePath;
     _action = action;
 }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:8,代码来源:RuleSetInclude.cs


示例14: SetWarnings

 private void SetWarnings(string warnings, ReportDiagnostic reportStyle)
 {
     if (!string.IsNullOrEmpty(warnings))
     {
         foreach (var warning in warnings.Split(preprocessorSymbolSeparators, StringSplitOptions.None))
         {
             int warningId;
             if (int.TryParse(warning, out warningId))
             {
                 this.Warnings["CS" + warningId.ToString("0000")] = reportStyle;
             }
         }
     }
 }
开发者ID:riversky,项目名称:roslyn,代码行数:14,代码来源:CSharpProjectFileLoader.CSharpProjectFile.cs


示例15: AssertSpecificDiagnostics

        private static void AssertSpecificDiagnostics(int[] expectedCodes, ReportDiagnostic[] expectedOptions, CSharpCommandLineArguments args)
        {
            var actualOrdered = args.CompilationOptions.SpecificDiagnosticOptions.OrderBy(entry => entry.Key);

            AssertEx.Equal(
                expectedCodes.Select(i => MessageProvider.Instance.GetIdForErrorCode(i)),
                actualOrdered.Select(entry => entry.Key));

            AssertEx.Equal(expectedOptions, actualOrdered.Select(entry => entry.Value));
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:10,代码来源:CommandLineTests.cs


示例16: CompilationOptions

        // Expects correct arguments.
        internal CompilationOptions(
            OutputKind outputKind,
            string moduleName,
            string mainTypeName,
            string scriptClassName,
            string cryptoKeyContainer,
            string cryptoKeyFile,
            bool? delaySign,
            OptimizationLevel optimizationLevel,
            bool checkOverflow,
            int fileAlignment,
            ulong baseAddress,
            Platform platform,
            ReportDiagnostic generalDiagnosticOption,
            int warningLevel,
            ImmutableDictionary<string, ReportDiagnostic> specificDiagnosticOptions,
            bool highEntropyVirtualAddressSpace,
            SubsystemVersion subsystemVersion,
            bool concurrentBuild,
            XmlReferenceResolver xmlReferenceResolver,
            SourceReferenceResolver sourceReferenceResolver,
            MetadataReferenceResolver metadataReferenceResolver,
            MetadataReferenceProvider metadataReferenceProvider,
            AssemblyIdentityComparer assemblyIdentityComparer,
            StrongNameProvider strongNameProvider,
            MetadataImportOptions metadataImportOptions,
            ImmutableArray<string> features)
        {
            this.OutputKind = outputKind;
            this.ModuleName = moduleName;
            this.MainTypeName = mainTypeName;
            this.ScriptClassName = scriptClassName;
            this.CryptoKeyContainer = cryptoKeyContainer;
            this.CryptoKeyFile = cryptoKeyFile;
            this.DelaySign = delaySign;
            this.CheckOverflow = checkOverflow;
            this.FileAlignment = fileAlignment;
            this.BaseAddress = baseAddress;
            this.Platform = platform;
            this.GeneralDiagnosticOption = generalDiagnosticOption;
            this.WarningLevel = warningLevel;
            this.SpecificDiagnosticOptions = specificDiagnosticOptions;
            this.HighEntropyVirtualAddressSpace = highEntropyVirtualAddressSpace;
            this.OptimizationLevel = optimizationLevel;
            this.ConcurrentBuild = concurrentBuild;
            this.SubsystemVersion = subsystemVersion;
            this.XmlReferenceResolver = xmlReferenceResolver;
            this.SourceReferenceResolver = sourceReferenceResolver;
            this.MetadataReferenceResolver = metadataReferenceResolver;
            this.MetadataReferenceProvider = metadataReferenceProvider;
            this.StrongNameProvider = strongNameProvider;
            this.AssemblyIdentityComparer = assemblyIdentityComparer ?? AssemblyIdentityComparer.Default;
            this.MetadataImportOptions = metadataImportOptions;
            this.Features = features;

            this.lazyErrors = new Lazy<ImmutableArray<Diagnostic>>(() =>
            {
                var builder = ArrayBuilder<Diagnostic>.GetInstance();
                ValidateOptions(builder);
                return builder.ToImmutableAndFree();
            });
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:63,代码来源:CompilationOptions.cs


示例17: RuleSetInclude

 /// <summary>
 /// Create a RuleSetInclude given the includepath and the effective action.
 /// </summary>
 public  RuleSetInclude(string includePath, ReportDiagnostic action)
 {
     this.includePath = includePath;
     this.action = action;
 }
开发者ID:riversky,项目名称:roslyn,代码行数:8,代码来源:RuleSetInclude.cs


示例18: CommonWithGeneralDiagnosticOption

 protected abstract CompilationOptions CommonWithGeneralDiagnosticOption(ReportDiagnostic generalDiagnosticOption);
开发者ID:nemec,项目名称:roslyn,代码行数:1,代码来源:CompilationOptions.cs


示例19: CompilationOptions

        // Expects correct arguments.
        internal CompilationOptions(
            OutputKind outputKind,
            bool reportSuppressedDiagnostics,
            string moduleName,
            string mainTypeName,
            string scriptClassName,
            string cryptoKeyContainer,
            string cryptoKeyFile,
            ImmutableArray<byte> cryptoPublicKey,
            bool? delaySign,
            OptimizationLevel optimizationLevel,
            bool checkOverflow,
            Platform platform,
            ReportDiagnostic generalDiagnosticOption,
            int warningLevel,
            ImmutableDictionary<string, ReportDiagnostic> specificDiagnosticOptions,
            bool concurrentBuild,
            bool extendedCustomDebugInformation,
            bool debugPlusMode,
            XmlReferenceResolver xmlReferenceResolver,
            SourceReferenceResolver sourceReferenceResolver,
            MetadataReferenceResolver metadataReferenceResolver,
            AssemblyIdentityComparer assemblyIdentityComparer,
            StrongNameProvider strongNameProvider,
            MetadataImportOptions metadataImportOptions)
        {
            this.OutputKind = outputKind;
            this.ModuleName = moduleName;
            this.MainTypeName = mainTypeName;
            this.ScriptClassName = scriptClassName ?? WellKnownMemberNames.DefaultScriptClassName;
            this.CryptoKeyContainer = cryptoKeyContainer;
            this.CryptoKeyFile = cryptoKeyFile;
            this.CryptoPublicKey = cryptoPublicKey.NullToEmpty();
            this.DelaySign = delaySign;
            this.CheckOverflow = checkOverflow;
            this.Platform = platform;
            this.GeneralDiagnosticOption = generalDiagnosticOption;
            this.WarningLevel = warningLevel;
            this.SpecificDiagnosticOptions = specificDiagnosticOptions;
            this.ReportSuppressedDiagnostics = reportSuppressedDiagnostics;
            this.OptimizationLevel = optimizationLevel;
            this.ConcurrentBuild = concurrentBuild;
            this.ExtendedCustomDebugInformation = extendedCustomDebugInformation;
            this.DebugPlusMode = debugPlusMode;
            this.XmlReferenceResolver = xmlReferenceResolver;
            this.SourceReferenceResolver = sourceReferenceResolver;
            this.MetadataReferenceResolver = metadataReferenceResolver;
            this.StrongNameProvider = strongNameProvider;
            this.AssemblyIdentityComparer = assemblyIdentityComparer ?? AssemblyIdentityComparer.Default;
            this.MetadataImportOptions = metadataImportOptions;

            _lazyErrors = new Lazy<ImmutableArray<Diagnostic>>(() =>
            {
                var builder = ArrayBuilder<Diagnostic>.GetInstance();
                ValidateOptions(builder);
                return builder.ToImmutableAndFree();
            });
        }
开发者ID:nemec,项目名称:roslyn,代码行数:59,代码来源:CompilationOptions.cs


示例20: UpdateRuleSetFile

        private void UpdateRuleSetFile(string pathToRuleSet, ReportDiagnostic value)
        {
            var ruleSetDocument = XDocument.Load(pathToRuleSet);

            var newAction = ConvertReportDiagnosticToAction(value);

            var analyzerID = _analyzerItem.AnalyzerReference.Display;
            var rules = FindOrCreateRulesElement(ruleSetDocument, analyzerID);
            var rule = FindOrCreateRuleElement(rules, _descriptor.Id);
            rule.Attribute("Action").Value = newAction;

            var allMatchingRules = ruleSetDocument.Root
                                   .Descendants("Rule")
                                   .Where(r => r.Attribute("Id").Value.Equals(_descriptor.Id));

            foreach (var matchingRule in allMatchingRules)
            {
                matchingRule.Attribute("Action").Value = newAction;
            }

            ruleSetDocument.Save(pathToRuleSet);
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:22,代码来源:DiagnosticItem.cs



注:本文中的ReportDiagnostic类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ReportDocument类代码示例发布时间:2022-05-24
下一篇:
C# ReportDataSource类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap