@@ -280,12 +280,18 @@ private static void BuildAssembly(IAssemblySymbol asm, EscapingTextWriter trapFi
280280 private static void BuildFunctionPointerTypeId ( this IFunctionPointerTypeSymbol funptr , Context cx , EscapingTextWriter trapFile , ISymbol symbolBeingDefined ) =>
281281 BuildFunctionPointerSignature ( funptr , trapFile , s => s . BuildOrWriteId ( cx , trapFile , symbolBeingDefined ) ) ;
282282
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+
283289 private static void BuildNamedTypeId ( this INamedTypeSymbol named , Context cx , EscapingTextWriter trapFile , ISymbol symbolBeingDefined , bool constructUnderlyingTupleType )
284290 {
285291 if ( ! constructUnderlyingTupleType && named . IsTupleType )
286292 {
287293 trapFile . Write ( '(' ) ;
288- trapFile . BuildList ( "," , named . TupleElements ,
294+ trapFile . BuildList ( "," , named . TupleElementsAdjusted ( ) ,
289295 f =>
290296 {
291297 trapFile . Write ( ( f . CorrespondingTupleField ?? f ) . Name ) ;
@@ -464,7 +470,7 @@ private static void BuildNamedTypeDisplayName(this INamedTypeSymbol namedType, C
464470 trapFile . Write ( '(' ) ;
465471 trapFile . BuildList (
466472 "," ,
467- namedType . TupleElements . Select ( f => f . Type ) ,
473+ namedType . TupleElementsAdjusted ( ) . Select ( f => f . Type ) ,
468474 t => t . BuildDisplayName ( cx , trapFile ) ) ;
469475 trapFile . Write ( ")" ) ;
470476 return ;
0 commit comments