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


C# CodeAnalysis.CommonMessageProvider类代码示例

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


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

示例1: DiagnosticInfo

        // Only the compiler creates instances.
        internal DiagnosticInfo(CommonMessageProvider messageProvider, int errorCode, params object[] arguments)
            : this(messageProvider, errorCode)
        {
            AssertMessageSerializable(arguments);

            _arguments = arguments;
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:8,代码来源:DiagnosticInfo.cs

示例2: CreateDescriptor

 private static DiagnosticDescriptor CreateDescriptor(int errorCode, DiagnosticSeverity defaultSeverity, CommonMessageProvider messageProvider)
 {
     var id = messageProvider.GetIdForErrorCode(errorCode);
     var title = messageProvider.GetTitle(errorCode);
     var description = messageProvider.GetDescription(errorCode);
     var messageFormat = messageProvider.GetMessageFormat(errorCode);
     var helpLink = messageProvider.GetHelpLink(errorCode);
     var category = messageProvider.GetCategory(errorCode);
     var customTags = GetCustomTags(defaultSeverity);
     return new DiagnosticDescriptor(id, title, messageFormat, category, defaultSeverity,
         isEnabledByDefault: true, description: description, helpLinkUri: helpLink, customTags: customTags);
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:12,代码来源:DiagnosticInfo.cs

示例3: CommonSyntaxAndDeclarationManager

 public CommonSyntaxAndDeclarationManager(
     ImmutableArray<SyntaxTree> externalSyntaxTrees,
     string scriptClassName,
     SourceReferenceResolver resolver,
     CommonMessageProvider messageProvider,
     bool isSubmission)
 {
     this.ExternalSyntaxTrees = externalSyntaxTrees;
     this.ScriptClassName = scriptClassName ?? "";
     this.Resolver = resolver;
     this.MessageProvider = messageProvider;
     this.IsSubmission = isSubmission;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:13,代码来源:CommonSyntaxAndDeclarationManager.cs

示例4: 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

示例5: Create

        internal static StrongNameKeys Create(StrongNameProvider providerOpt, string keyFilePath, string keyContainerName, CommonMessageProvider messageProvider)
        {
            if (string.IsNullOrEmpty(keyFilePath) && string.IsNullOrEmpty(keyContainerName))
            {
                return None;
            }

            if (providerOpt == null)
            {
                var diagnostic = GetError(keyFilePath, keyContainerName, new CodeAnalysisResourcesLocalizableErrorArgument(nameof(CodeAnalysisResources.AssemblySigningNotSupported)), messageProvider);
                return new StrongNameKeys(diagnostic);
            }

            return providerOpt.CreateKeys(keyFilePath, keyContainerName, messageProvider);
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:15,代码来源:StrongNameKeys.cs

示例6: DiagnosticInfo

        // Only the compiler creates instances.
        internal DiagnosticInfo(CommonMessageProvider messageProvider, int errorCode, params object[] arguments)
            : this(messageProvider, errorCode)
        {
            Debug.Assert(Array.TrueForAll(arguments, arg => arg != null && (arg is IMessageSerializable || arg.GetType().IsSerializable)));

            this.arguments = arguments;
#if false
            if (arguments != null)
            {
                foreach (var arg in arguments)
                {
                    Debug.Assert(arg != null, "Diagnostic argument is null");
                    Debug.Assert(!arg.GetType().IsEnum, "Enum used as diagnostic argument");
                }
            }
#endif
        }
开发者ID:riversky,项目名称:roslyn,代码行数:18,代码来源:DiagnosticInfo.cs

示例7: WritePeToStream

        public static bool WritePeToStream(
            EmitContext context,
            CommonMessageProvider messageProvider,
            Func<Stream> getPeStream,
            PdbWriter nativePdbWriterOpt,
            string pdbPathOpt,
            bool allowMissingMethodBodies,
            bool deterministic,
            CancellationToken cancellationToken)
        {
            // If PDB writer is given, we have to have PDB path.
            Debug.Assert(nativePdbWriterOpt == null || pdbPathOpt != null);

            var peWriter = new PeWriter(context.Module, pdbPathOpt, deterministic);
            var mdWriter = FullMetadataWriter.Create(context, messageProvider, allowMissingMethodBodies, deterministic, cancellationToken);

            return peWriter.WritePeToStream(mdWriter, getPeStream, nativePdbWriterOpt);
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:18,代码来源:PeWriter.cs

示例8: WritePeToStream

        public static void WritePeToStream(
            EmitContext context,
            CommonMessageProvider messageProvider,
            Stream peStream,
            PdbWriter nativePdbWriterOpt,
            bool allowMissingMethodBodies,
            bool deterministic,
            CancellationToken cancellationToken)
        {
            var peWriter = new PeWriter(context.Module, nativePdbWriterOpt, deterministic);

            var mdWriter = FullMetadataWriter.Create(context, messageProvider, allowMissingMethodBodies, deterministic, cancellationToken);

            if (nativePdbWriterOpt != null)
            {
                nativePdbWriterOpt.SetMetadataEmitter(mdWriter);
            }

            uint entryPointToken;
            peWriter.WritePeToStream(mdWriter, peStream, nativePdbWriterOpt, out entryPointToken);

            if (nativePdbWriterOpt != null)
            {
                if (entryPointToken != 0)
                {
                    nativePdbWriterOpt.SetEntryPoint(entryPointToken);
                }

                var assembly = context.Module.AsAssembly;
                if (assembly != null && assembly.Kind == ModuleKind.WindowsRuntimeMetadata)
                {
                    // Dev12: If compiling to winmdobj, we need to add to PDB source spans of
                    //        all types and members for better error reporting by WinMDExp.
                    nativePdbWriterOpt.WriteDefinitionLocations(context.Module.GetSymbolToLocationMap());
                }
            }
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:37,代码来源:PeWriter.cs

示例9: GetError

 internal static Diagnostic GetError(string keyFilePath, string keyContainerName, object message, CommonMessageProvider messageProvider)
 {
     if (keyContainerName != null)
     {
         return GetContainerError(messageProvider, keyContainerName, message);
     }
     else
     {
         return GetKeyFileError(messageProvider, keyFilePath, message);
     }
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:11,代码来源:StrongNameKeys.cs

示例10: ResolveRelativePath

        private static string ResolveRelativePath(CommonMessageProvider messageProvider, string path, string baseDirectory, IList<DiagnosticInfo> errors)
        {
            string fullPath = FileUtilities.ResolveRelativePath(path, baseDirectory);
            if (fullPath == null)
            {
                errors.Add(new DiagnosticInfo(messageProvider, messageProvider.FTL_InputFileNameTooLong, path));
            }

            return fullPath;
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:10,代码来源:CommonCompiler.cs

示例11: OpenStream

        private static Stream OpenStream(CommonMessageProvider messageProvider, string path, string baseDirectory, int errorCode, IList<DiagnosticInfo> errors)
        {
            if (path == null)
            {
                return null;
            }

            string fullPath = ResolveRelativePath(messageProvider, path, baseDirectory, errors);
            if (fullPath == null)
            {
                return null;
            }

            try
            {
                return PortableShim.FileStream.Create(fullPath, PortableShim.FileMode.Open, PortableShim.FileAccess.Read);
            }
            catch (Exception ex)
            {
                errors.Add(new DiagnosticInfo(messageProvider, errorCode, fullPath, ex.Message));
            }

            return null;
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:24,代码来源:CommonCompiler.cs

示例12: OpenManifestStream

 private static Stream OpenManifestStream(CommonMessageProvider messageProvider, OutputKind outputKind, CommandLineArguments arguments, List<DiagnosticInfo> errorList)
 {
     return outputKind.IsNetModule()
         ? null
         : OpenStream(messageProvider, arguments.Win32Manifest, arguments.BaseDirectory, messageProvider.ERR_CantOpenWin32Manifest, errorList);
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:6,代码来源:CommonCompiler.cs

示例13: CommandLineParser

 internal CommandLineParser(CommonMessageProvider messageProvider, bool isInteractive)
 {
     Debug.Assert(messageProvider != null);
     this.messageProvider = messageProvider;
     this.isInteractive = isInteractive;
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:6,代码来源:CommonCommandLineParser.cs

示例14: 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

示例15: GetDescriptor

 internal static DiagnosticDescriptor GetDescriptor(int errorCode, CommonMessageProvider messageProvider)
 {
     var defaultSeverity = messageProvider.GetSeverity(errorCode);
     return GetOrCreateDescriptor(errorCode, defaultSeverity, messageProvider);
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:5,代码来源:DiagnosticInfo.cs


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