-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C#: Workaround Roslyn bug in INamedTypeSymbol.TupleElements
#7646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C#: Workaround Roslyn bug in INamedTypeSymbol.TupleElements
#7646
Conversation
First approach did not work, since it will potentially produce overlapping TRAP IDs, and in effect DB inconsistencies like
|
Good catch. |
Yeah, good catch CI ;-) |
@@ -90,7 +90,11 @@ protected override void Populate(TextWriter trapFile) | |||
var tts = (TupleTypeSyntax)syntax; | |||
var tt = (TupleType)type; | |||
Emit(trapFile, loc ?? syntax.GetLocation(), parent, type); | |||
tts.Elements.Zip(tt.TupleElements, (s, t) => Create(Context, s.Type, this, t.Type)).Enumerate(); | |||
foreach (var (s, t) in tts.Elements.Zip(tt.TupleElements, (s, t) => (s, t?.Type))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be more explicit, and use GetTupleElementsMaybeNull()
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, definitely. I was sure I had done that, but I guess not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, wait, that is actually the field Field?[] TupleElements
on the class TupleType
, which uses GetTupleElementsMaybeNull
internally.
We occasionally see errors like this:
and
It appears to be the same issue as discussed in dotnet/roslyn#53943.