-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Area-CompilersBugTenet-ReliabilityCustomer telemetry indicates that the product is failing in a crash/hang/dataloss manner.Customer telemetry indicates that the product is failing in a crash/hang/dataloss manner.
Milestone
Description
Version Used: 441c154
Steps to Reproduce:
using System;
namespace System
{
public class ObsoleteAttribute : Attribute
{
public ObsoleteAttribute(string s1, string s2) { }
}
}
public class C
{
[Obsolete("a", "b")]
public void M()
{
}
}
Expected Behavior:
Because the constructor in use does not match any well-known signature, we should produce an obsolete warning with no custom message and a "warning" severity produce no diagnostic at all on usage of C.M
.
Actual Behavior:
Crash:
System.AggregateException: One or more errors occurred. (Unable to cast object of type 'System.String' to type 'System.Boolean'.)
---> System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Boolean'.
at Microsoft.CodeAnalysis.AttributeData.DecodeObsoleteAttribute() in /_/src/Compilers/Core/Portable/Symbols/Attributes/CommonAttributeData.cs:line 283
at Microsoft.CodeAnalysis.AttributeData.DecodeObsoleteAttribute(ObsoleteAttributeKind kind) in /_/src/Compilers/Core/Portable/Symbols/Attributes/CommonAttributeData.cs:line 252
at Microsoft.CodeAnalysis.CSharp.Symbol.EarlyDecodeDeprecatedOrExperimentalOrObsoleteAttribute(EarlyDecodeWellKnownAttributeArguments`4& arguments, CSharpAttributeData& attributeData, ObsoleteAttributeData& obsoleteData) in /_/src/Compilers/CSharp/Portable/Symbols/Symbol_Attributes.cs:line 186
at Microsoft.CodeAnalysis.CSharp.Symbols.SourceMethodSymbolWithAttributes.EarlyDecodeWellKnownAttribute(EarlyDecodeWellKnownAttributeArguments`4& arguments) in /_/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs:line 340
at Microsoft.CodeAnalysis.CSharp.Symbol.EarlyDecodeWellKnownAttributes(ImmutableArray`1 binders, ImmutableArray`1 boundAttributeTypes, ImmutableArray`1 attributesToBind, AttributeLocation symbolPart, CSharpAttributeData[] boundAttributesBuilder) in /_/src/Compilers/CSharp/Portable/Symbols/Symbol_Attributes.cs:line 579
at Microsoft.CodeAnalysis.CSharp.Symbol.LoadAndValidateAttributes(OneOrMany`1 attributesSyntaxLists, CustomAttributesBag`1& lazyCustomAttributesBag, AttributeLocation symbolPart, Boolean earlyDecodingOnly, Binder binderOpt, Func`2 attributeMatchesOpt) in /_/src/Compilers/CSharp/Portable/Symbols/Symbol_Attributes.cs:line 362
at Microsoft.CodeAnalysis.CSharp.Symbols.SourceMethodSymbolWithAttributes.GetAttributesBag(CustomAttributesBag`1& lazyCustomAttributesBag, Boolean forReturnType) in /_/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs:line 279
at Microsoft.CodeAnalysis.CSharp.Symbols.SourceMethodSymbolWithAttributes.GetAttributesBag() in /_/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs:line 229
at Microsoft.CodeAnalysis.CSharp.Symbols.SourceMethodSymbolWithAttributes.GetAttributes() in /_/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs:line 293
We assume that an ObsoleteAttribute constructor with a sufficient number of parameters will have certain types for those parameters.
isError = (bool)args[1].ValueInternal; |
/cc @AlekseyTs
Metadata
Metadata
Assignees
Labels
Area-CompilersBugTenet-ReliabilityCustomer telemetry indicates that the product is failing in a crash/hang/dataloss manner.Customer telemetry indicates that the product is failing in a crash/hang/dataloss manner.