當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。