本文整理汇总了C#中DiagnosticInfo类的典型用法代码示例。如果您正苦于以下问题:C# DiagnosticInfo类的具体用法?C# DiagnosticInfo怎么用?C# DiagnosticInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DiagnosticInfo类属于命名空间,在下文中一共展示了DiagnosticInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
示例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);
}
}
示例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);
}
示例4: PopulateHelper
private void PopulateHelper(BoundExpression receiverOpt, LookupResultKind resultKind, DiagnosticInfo error)
{
VerifyClear();
this.Receiver = receiverOpt;
this.Error = error;
this.ResultKind = resultKind;
}
示例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;
}
示例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);
}
}
示例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;
}
示例8: SyntaxIdentifierWithTrailingTrivia
internal SyntaxIdentifierWithTrailingTrivia(string text, GreenNode trailing, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations)
: base(text, diagnostics, annotations)
{
if (trailing != null)
{
this.AdjustFlagsAndWidth(trailing);
_trailing = trailing;
}
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
}
示例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;
}
}