File tree Expand file tree Collapse file tree
test/TestCases/napi-dotnet Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -395,6 +395,7 @@ private void ExportModule(
395395 }
396396
397397 // Generate adapters for exported delegates for later use in method marshalling.
398+ // Delegate types are not exported as properties, only as marshalling adapters.
398399 foreach ( ITypeSymbol exportDelegate in exportItems . OfType < ITypeSymbol > ( )
399400 . Where ( ( t ) => t . TypeKind == TypeKind . Delegate ) )
400401 {
@@ -659,8 +660,10 @@ private void ExportMembers(
659660 {
660661 s += $ ".AddProperty(\" { field . Name } \" , { field . ConstantValue } , { propertyAttributes } )";
661662 }
662- else if ( member is INamedTypeSymbol nestedType )
663+ else if ( member is INamedTypeSymbol nestedType &&
664+ nestedType . TypeKind != TypeKind . Delegate )
663665 {
666+ // Delegate types are not exported as properties, only as marshalling adapters.
664667 string nestedTypeVariableName = "type_" + GetFullName ( nestedType ) . Replace ( '.' , '_' ) ;
665668 s += $ ".AddProperty(\" { GetExportName ( nestedType ) } \" , { nestedTypeVariableName } , " +
666669 $ "{ propertyAttributes } )";
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ namespace Microsoft.JavaScript.NodeApi.TestCases;
1515[ JSExport ]
1616public static class Delegates
1717{
18+ public delegate string NestedDelegate ( string value ) ;
19+
1820 public static void CallAction ( Action < int > actionDelegate , int value ) => actionDelegate ( value ) ;
1921
2022 public static int CallFunc ( Func < int , int > funcDelegate , int value ) => funcDelegate ( value ) ;
You can’t perform that action at this time.
0 commit comments