@@ -280,12 +280,18 @@ private static void BuildAssembly(IAssemblySymbol asm, EscapingTextWriter trapFi
280
280
private static void BuildFunctionPointerTypeId ( this IFunctionPointerTypeSymbol funptr , Context cx , EscapingTextWriter trapFile , ISymbol symbolBeingDefined ) =>
281
281
BuildFunctionPointerSignature ( funptr , trapFile , s => s . BuildOrWriteId ( cx , trapFile , symbolBeingDefined ) ) ;
282
282
283
+ /// <summary>
284
+ /// Workaround for a Roslyn bug: https://github.com/dotnet/roslyn/issues/53943
285
+ /// </summary>
286
+ public static IEnumerable < IFieldSymbol > TupleElementsAdjusted ( this INamedTypeSymbol type ) =>
287
+ type . TupleElements . Where ( f => f is not null && f . Type is not null ) ;
288
+
283
289
private static void BuildNamedTypeId ( this INamedTypeSymbol named , Context cx , EscapingTextWriter trapFile , ISymbol symbolBeingDefined , bool constructUnderlyingTupleType )
284
290
{
285
291
if ( ! constructUnderlyingTupleType && named . IsTupleType )
286
292
{
287
293
trapFile . Write ( '(' ) ;
288
- trapFile . BuildList ( "," , named . TupleElements ,
294
+ trapFile . BuildList ( "," , named . TupleElementsAdjusted ( ) ,
289
295
f =>
290
296
{
291
297
trapFile . Write ( ( f . CorrespondingTupleField ?? f ) . Name ) ;
@@ -464,7 +470,7 @@ private static void BuildNamedTypeDisplayName(this INamedTypeSymbol namedType, C
464
470
trapFile . Write ( '(' ) ;
465
471
trapFile . BuildList (
466
472
"," ,
467
- namedType . TupleElements . Select ( f => f . Type ) ,
473
+ namedType . TupleElementsAdjusted ( ) . Select ( f => f . Type ) ,
468
474
t => t . BuildDisplayName ( cx , trapFile ) ) ;
469
475
trapFile . Write ( ")" ) ;
470
476
return ;
0 commit comments