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

C# DiagnosticInfo类代码示例

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

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



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

示例1: ExtendedErrorTypeSymbol

 internal ExtendedErrorTypeSymbol(NamespaceOrTypeSymbol containingSymbol, ImmutableArray<Symbol> candidateSymbols, LookupResultKind resultKind, DiagnosticInfo errorInfo, int arity, bool unreported = false)
     : this(containingSymbol, candidateSymbols[0].Name, arity, errorInfo, unreported)
 {
     _candidateSymbols = UnwrapErrorCandidates(candidateSymbols);
     _resultKind = resultKind;
     Debug.Assert(candidateSymbols.IsEmpty || resultKind != LookupResultKind.Viable, "Shouldn't use LookupResultKind.Viable with candidate symbols");
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:7,代码来源:ExtendedErrorTypeSymbol.cs


示例2: PEFieldSymbol

        internal PEFieldSymbol(
            PEModuleSymbol moduleSymbol,
            PENamedTypeSymbol containingType,
            FieldDefinitionHandle fieldDef)
        {
            Debug.Assert((object)moduleSymbol != null);
            Debug.Assert((object)containingType != null);
            Debug.Assert(!fieldDef.IsNil);

            _handle = fieldDef;
            _containingType = containingType;

            try
            {
                moduleSymbol.Module.GetFieldDefPropsOrThrow(fieldDef, out _name, out _flags);
            }
            catch (BadImageFormatException)
            {
                if ((object)_name == null)
                {
                    _name = String.Empty;
                }

                _lazyUseSiteDiagnostic = new CSDiagnosticInfo(ErrorCode.ERR_BindToBogus, this);
            }
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:26,代码来源:PEFieldSymbol.cs


示例3: TestDiagnostic

        public void TestDiagnostic()
        {
            MockMessageProvider provider = new MockMessageProvider();
            SyntaxTree syntaxTree = new MockSyntaxTree();
            CultureInfo englishCulture = CultureHelpers.EnglishCulture;

            DiagnosticInfo di1 = new DiagnosticInfo(provider, 1);
            Assert.Equal(1, di1.Code);
            Assert.Equal(DiagnosticSeverity.Error, di1.Severity);
            Assert.Equal("MOCK0001", di1.MessageIdentifier);
            Assert.Equal("The first error", di1.GetMessage(englishCulture));

            DiagnosticInfo di2 = new DiagnosticInfo(provider, 1002, "Elvis", "Mort");
            Assert.Equal(1002, di2.Code);
            Assert.Equal(DiagnosticSeverity.Warning, di2.Severity);
            Assert.Equal("MOCK1002", di2.MessageIdentifier);
            Assert.Equal("The second warning about Elvis and Mort", di2.GetMessage(englishCulture));

            Location l1 = new SourceLocation(syntaxTree, new TextSpan(5, 8));
            var d1 = new CSDiagnostic(di2, l1);
            Assert.Equal(l1, d1.Location);
            Assert.Same(syntaxTree, d1.Location.SourceTree);
            Assert.Equal(new TextSpan(5, 8), d1.Location.SourceSpan);
            Assert.Equal(0, d1.AdditionalLocations.Count());
            Assert.Same(di2, d1.Info);
        }
开发者ID:rgani,项目名称:roslyn,代码行数:26,代码来源:DiagnosticTest.cs


示例4: PopulateHelper

 private void PopulateHelper(BoundExpression receiverOpt, LookupResultKind resultKind, DiagnosticInfo error)
 {
     VerifyClear();
     this.Receiver = receiverOpt;
     this.Error = error;
     this.ResultKind = resultKind;
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:7,代码来源:MethodGroup.cs


示例5: LazyObsoleteDiagnosticInfo

 internal LazyObsoleteDiagnosticInfo(Symbol symbol, Symbol containingSymbol, BinderFlags binderFlags)
     : base(CSharp.MessageProvider.Instance, (int)ErrorCode.Unknown)
 {
     this.symbol = symbol;
     this.containingSymbol = containingSymbol;
     this.binderFlags = binderFlags;
     this.lazyActualObsoleteDiagnostic = null;
 }
开发者ID:riversky,项目名称:roslyn,代码行数:8,代码来源:LazyObsoleteDiagnosticInfo.cs


示例6: ApplyDiagnosticMasks

 /// <summary>
 /// Applies the diagnostic mask if the object was initialize with a ServiceResult.
 /// </summary>
 public void ApplyDiagnosticMasks(DiagnosticsMasks diagnosticMasks, StringTable stringTable)
 {
     if (m_result != null)
     {
         m_statusCode     = m_result.StatusCode;
         m_diagnosticInfo = new DiagnosticInfo(m_result, diagnosticMasks, false, stringTable);
     }
 }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:11,代码来源:StatusResult.cs


示例7: TupleErrorFieldSymbol

 public TupleErrorFieldSymbol(NamedTypeSymbol container, string name, int tupleFieldId, Location location, TypeSymbol type, DiagnosticInfo useSiteDiagnosticInfo)
     : base(container, name, isPublic:true, isReadOnly:false, isStatic:false)
 {
     Debug.Assert(name != null);
     _type = type;
     _locations = location == null ? ImmutableArray<Location>.Empty : ImmutableArray.Create(location);
     _useSiteDiagnosticInfo = useSiteDiagnosticInfo;
     _tupleFieldId = tupleFieldId;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:9,代码来源:TupleErrorFieldSymbol.cs


示例8: SyntaxIdentifierWithTrailingTrivia

 internal SyntaxIdentifierWithTrailingTrivia(string text, GreenNode trailing, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations)
     : base(text, diagnostics, annotations)
 {
     if (trailing != null)
     {
         this.AdjustFlagsAndWidth(trailing);
         _trailing = trailing;
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:9,代码来源:SyntaxToken.SyntaxIdentifierWithTrailingTrivia.cs


示例9: WithTwoChildren

 internal WithTwoChildren(DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations, GreenNode child0, GreenNode child1)
     : base(diagnostics, annotations)
 {
     this.SlotCount = 2;
     this.AdjustFlagsAndWidth(child0);
     _child0 = child0;
     this.AdjustFlagsAndWidth(child1);
     _child1 = child1;
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:9,代码来源:SyntaxList.WithTwoChildren.cs


示例10: PopulateWithSingleMethod

 internal void PopulateWithSingleMethod(
     BoundExpression receiverOpt,
     MethodSymbol method,
     LookupResultKind resultKind = LookupResultKind.Viable,
     DiagnosticInfo error = null)
 {
     this.PopulateHelper(receiverOpt, resultKind, error);
     this.Methods.Add(method);
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:9,代码来源:MethodGroup.cs


示例11: TupleErrorFieldSymbol

 public TupleErrorFieldSymbol(NamedTypeSymbol container, string name, int tupleElementIndex, Location location, TypeSymbol type, DiagnosticInfo useSiteDiagnosticInfo, bool isImplicitlyDeclared)
     : base(container, name, isPublic:true, isReadOnly:false, isStatic:false)
 {
     Debug.Assert(name != null);
     _type = type;
     _locations = location == null ? ImmutableArray<Location>.Empty : ImmutableArray.Create(location);
     _useSiteDiagnosticInfo = useSiteDiagnosticInfo;
     _tupleElementIndex = tupleElementIndex;
     _isImplicitlyDeclared = isImplicitlyDeclared;
 }
开发者ID:jkotas,项目名称:roslyn,代码行数:10,代码来源:TupleErrorFieldSymbol.cs


示例12: CreateTypeArguments

 public static ImmutableArray<TypeWithModifiers> CreateTypeArguments(ImmutableArray<TypeParameterSymbol> typeParameters, int n, DiagnosticInfo errorInfo)
 {
     var result = ArrayBuilder<TypeWithModifiers>.GetInstance();
     for (int i = 0; i < n; i++)
     {
         string name = (i < typeParameters.Length) ? typeParameters[i].Name : string.Empty;
         result.Add(new TypeWithModifiers(new UnboundArgumentErrorTypeSymbol(name, errorInfo)));
     }
     return result.ToImmutableAndFree();
 }
开发者ID:RoryVL,项目名称:roslyn,代码行数:10,代码来源:UnboundGenericType.cs


示例13: DiagnosticInfo

 public DiagnosticInfo(int namespaceUri = -1, int symbolicId = -1, int locale = -1, int localizedText = -1, string additionalInfo = null, StatusCode innerStatusCode = default(StatusCode), DiagnosticInfo innerDiagnosticInfo = null)
 {
     this.NamespaceUri = namespaceUri;
     this.SymbolicId = symbolicId;
     this.Locale = locale;
     this.LocalizedText = localizedText;
     this.AdditionalInfo = additionalInfo;
     this.InnerStatusCode = innerStatusCode;
     this.InnerDiagnosticInfo = innerDiagnosticInfo;
 }
开发者ID:yuriik83,项目名称:workstation-uaclient,代码行数:10,代码来源:DiagnosticInfo.cs


示例14: Run

 public override int Run(TextWriter consoleOutput, CancellationToken cancellationToken = default(CancellationToken))
 {
     try
     {
         return base.Run(consoleOutput, cancellationToken);
     }
     catch (OperationCanceledException)
     {
         DiagnosticInfo diag = new DiagnosticInfo(MessageProvider, (int)ErrorCode.ERR_CompileCancelled);
         PrintErrors(new[] { diag }, consoleOutput);
         return 1;
     }
 }
开发者ID:riversky,项目名称:roslyn,代码行数:13,代码来源:CSharpCompiler.cs


示例15: SyntaxTokenWithTrivia

 internal SyntaxTokenWithTrivia(SyntaxKind kind, CSharpSyntaxNode leading, CSharpSyntaxNode trailing, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations)
     : base(kind, diagnostics, annotations)
 {
     if (leading != null)
     {
         this.AdjustFlagsAndWidth(leading);
         this.LeadingField = leading;
     }
     if (trailing != null)
     {
         this.AdjustFlagsAndWidth(trailing);
         this.TrailingField = trailing;
     }
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:14,代码来源:SyntaxToken.SyntaxTokenWithTrivia.cs


示例16: PopulateWithNonExtensionMethods

 internal void PopulateWithNonExtensionMethods(
     BoundExpression receiverOpt,
     ImmutableArray<MethodSymbol> methods,
     ImmutableArray<TypeSymbol> typeArguments,
     LookupResultKind resultKind = LookupResultKind.Viable,
     DiagnosticInfo error = null)
 {
     this.PopulateHelper(receiverOpt, resultKind, error);
     this.Methods.AddRange(methods);
     if (!typeArguments.IsDefault)
     {
         this.TypeArguments.AddRange(typeArguments);
     }
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:14,代码来源:MethodGroup.cs


示例17: PopulateWithExtensionMethods

 internal void PopulateWithExtensionMethods(
     BoundExpression receiverOpt,
     ArrayBuilder<Symbol> members,
     ImmutableArray<TypeSymbol> typeArguments,
     LookupResultKind resultKind = LookupResultKind.Viable,
     DiagnosticInfo error = null)
 {
     this.PopulateHelper(receiverOpt, resultKind, error);
     this.IsExtensionMethodGroup = true;
     foreach (var member in members)
     {
         this.Methods.Add((MethodSymbol)member);
     }
     if (!typeArguments.IsDefault)
     {
         this.TypeArguments.AddRange(typeArguments);
     }
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:18,代码来源:MethodGroup.cs


示例18: SyntaxIdentifierWithTrivia

 internal SyntaxIdentifierWithTrivia(
     SyntaxKind contextualKind,
     string text,
     string valueText,
     GreenNode leading,
     GreenNode trailing,
     DiagnosticInfo[] diagnostics,
     SyntaxAnnotation[] annotations)
     : base(contextualKind, text, valueText, diagnostics, annotations)
 {
     if (leading != null)
     {
         this.AdjustFlagsAndWidth(leading);
         _leading = leading;
     }
     if (trailing != null)
     {
         this.AdjustFlagsAndWidth(trailing);
         _trailing = trailing;
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:21,代码来源:SyntaxToken.SyntaxIdentifierWithTrivia.cs


示例19: TupleErrorFieldSymbol

        public TupleErrorFieldSymbol(
            NamedTypeSymbol container, 
            string name, 
            int tupleElementIndex, 
            Location location, 
            TypeSymbol type, 
            DiagnosticInfo useSiteDiagnosticInfo, 
            bool isImplicitlyDeclared,
            TupleErrorFieldSymbol correspondingDefaultFieldOpt)

            : base(container, name, isPublic:true, isReadOnly:false, isStatic:false)
        {
            Debug.Assert(name != null);
            _type = type;
            _locations = location == null ? ImmutableArray<Location>.Empty : ImmutableArray.Create(location);
            _useSiteDiagnosticInfo = useSiteDiagnosticInfo;
            _tupleElementIndex = (object)correspondingDefaultFieldOpt == null ? tupleElementIndex << 1 : (tupleElementIndex << 1) + 1;
            _isImplicitlyDeclared = isImplicitlyDeclared;

            Debug.Assert((correspondingDefaultFieldOpt == null) == this.IsDefaultTupleElement);
            Debug.Assert(correspondingDefaultFieldOpt == null || correspondingDefaultFieldOpt.IsDefaultTupleElement);

            _correspondingDefaultField = correspondingDefaultFieldOpt ?? this;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:24,代码来源:TupleErrorFieldSymbol.cs


示例20: PETypeParameterSymbol

        private PETypeParameterSymbol(
            PEModuleSymbol moduleSymbol,
            Symbol definingSymbol,
            ushort ordinal,
            GenericParameterHandle handle)
        {
            Debug.Assert((object)moduleSymbol != null);
            Debug.Assert((object)definingSymbol != null);
            Debug.Assert(ordinal >= 0);
            Debug.Assert(!handle.IsNil);

            _containingSymbol = definingSymbol;

            GenericParameterAttributes flags = 0;

            try
            {
                moduleSymbol.Module.GetGenericParamPropsOrThrow(handle, out _name, out flags);
            }
            catch (BadImageFormatException)
            {
                if ((object)_name == null)
                {
                    _name = string.Empty;
                }

                _lazyBoundsErrorInfo = new CSDiagnosticInfo(ErrorCode.ERR_BindToBogus, this);
            }

            // Clear the '.ctor' flag if both '.ctor' and 'valuetype' are
            // set since '.ctor' is redundant in that case.
            _flags = ((flags & GenericParameterAttributes.NotNullableValueTypeConstraint) == 0) ? flags : (flags & ~GenericParameterAttributes.DefaultConstructorConstraint);

            _ordinal = ordinal;
            _handle = handle;
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:36,代码来源:PETypeParameterSymbol.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# DiagnosticInfoCollection类代码示例发布时间:2022-05-24
下一篇:
C# DiagnosticDescriptor类代码示例发布时间: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