当前位置: 首页>>代码示例>>C#>>正文


C# CommonMessageProvider.CreateDiagnostic方法代码示例

本文整理汇总了C#中Microsoft.CodeAnalysis.CommonMessageProvider.CreateDiagnostic方法的典型用法代码示例。如果您正苦于以下问题:C# CommonMessageProvider.CreateDiagnostic方法的具体用法?C# CommonMessageProvider.CreateDiagnostic怎么用?C# CommonMessageProvider.CreateDiagnostic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.CodeAnalysis.CommonMessageProvider的用法示例。


在下文中一共展示了CommonMessageProvider.CreateDiagnostic方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        internal static StrongNameKeys Create(ImmutableArray<byte> publicKey, CommonMessageProvider messageProvider)
        {
            Debug.Assert(!publicKey.IsDefaultOrEmpty);

            if (MetadataHelpers.IsValidPublicKey(publicKey))
            {
                return new StrongNameKeys(default(ImmutableArray<byte>), publicKey, null, null);
            }
            else
            {
                return new StrongNameKeys(messageProvider.CreateDiagnostic(messageProvider.ERR_BadCompilationOptionValue, Location.None,
                    nameof(CompilationOptions.CryptoPublicKey), BitConverter.ToString(publicKey.ToArray())));
            }
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:14,代码来源:StrongNameKeys.cs

示例2: ExceptionToDiagnostic

        internal static Diagnostic ExceptionToDiagnostic(Exception e, CommonMessageProvider messageProvider, Location location, string display, MetadataImageKind kind)
        {
            if (e is BadImageFormatException)
            {
                int errorCode = (kind == MetadataImageKind.Assembly) ? messageProvider.ERR_InvalidAssemblyMetadata : messageProvider.ERR_InvalidModuleMetadata;
                return messageProvider.CreateDiagnostic(errorCode, location, display, e.Message);
            }

            var fileNotFound = e as FileNotFoundException;
            if (fileNotFound != null)
            {
                return messageProvider.CreateDiagnostic(messageProvider.ERR_MetadataFileNotFound, location, fileNotFound.FileName ?? string.Empty);
            }
            else
            {
                int errorCode = (kind == MetadataImageKind.Assembly) ? messageProvider.ERR_ErrorOpeningAssemblyFile : messageProvider.ERR_ErrorOpeningModuleFile;
                return messageProvider.CreateDiagnostic(errorCode, location, display, e.Message);
            }
        }
开发者ID:swaroop-sridhar,项目名称:roslyn,代码行数:19,代码来源:PortableExecutableReference.cs

示例3: GetKeyFileError

 internal static Diagnostic GetKeyFileError(CommonMessageProvider messageProvider, string path, object message)
 {
     return messageProvider.CreateDiagnostic(messageProvider.ERR_PublicKeyFileFailure, Location.None, path, message);
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:4,代码来源:StrongNameKeys.cs

示例4: GetContainerError

 internal static Diagnostic GetContainerError(CommonMessageProvider messageProvider, string name, object message)
 {
     return messageProvider.CreateDiagnostic(messageProvider.ERR_PublicKeyContainerFailure, Location.None, name, message);
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:4,代码来源:StrongNameKeys.cs

示例5: ValidateOptions

        internal void ValidateOptions(ArrayBuilder<Diagnostic> builder, CommonMessageProvider messageProvider)
        {
            if (!CryptoPublicKey.IsEmpty)
            {
                if (CryptoKeyFile != null)
                {
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions,
                        Location.None, nameof(CryptoPublicKey), nameof(CryptoKeyFile)));
                }

                if (CryptoKeyContainer != null)
                {
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions,
                        Location.None, nameof(CryptoPublicKey), nameof(CryptoKeyContainer)));
                }
            }

            if (PublicSign)
            {
                if (CryptoKeyFile != null && !PathUtilities.IsAbsolute(CryptoKeyFile))
                {
                    // TODO(https://github.com/dotnet/roslyn/issues/9153):
                    // Produce better diagnostic message for passing a key file with a relative path
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_BadCompilationOptionValue,
                        Location.None, nameof(CryptoKeyFile), CryptoKeyFile));
                }

                if (CryptoKeyContainer != null)
                {
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions,
                        Location.None, nameof(PublicSign), nameof(CryptoKeyContainer)));
                }

                if (DelaySign == true)
                {
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions,
                        Location.None, nameof(PublicSign), nameof(DelaySign)));
                }
            }
        }
开发者ID:rgani,项目名称:roslyn,代码行数:40,代码来源:CompilationOptions.cs

示例6: ValidateOptions

        internal void ValidateOptions(ArrayBuilder<Diagnostic> builder, CommonMessageProvider messageProvider)
        {
            if (!CryptoPublicKey.IsEmpty)
            {
                if (CryptoKeyFile != null)
                {
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions,
                        Location.None, nameof(CryptoPublicKey), nameof(CryptoKeyFile)));
                }

                if (CryptoKeyContainer != null)
                {
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions,
                        Location.None, nameof(CryptoPublicKey), nameof(CryptoKeyContainer)));
                }
            }

            if (PublicSign)
            {
                if (CryptoKeyFile != null && !PathUtilities.IsAbsolute(CryptoKeyFile))
                {
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_OptionMustBeAbsolutePath,
                        Location.None, nameof(CryptoKeyFile)));
                }

                if (CryptoKeyContainer != null)
                {
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions,
                        Location.None, nameof(PublicSign), nameof(CryptoKeyContainer)));
                }

                if (DelaySign == true)
                {
                    builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions,
                        Location.None, nameof(PublicSign), nameof(DelaySign)));
                }
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:38,代码来源:CompilationOptions.cs


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