@@ -29,7 +29,7 @@ public DurableFunction(
2929 string name ,
3030 DurableFunctionKind kind ,
3131 TypedParameter parameter ,
32- ITypeSymbol returnType ,
32+ ITypeSymbol ? returnType ,
3333 bool returnsVoid ,
3434 HashSet < string > requiredNamespaces )
3535 {
@@ -38,7 +38,7 @@ public DurableFunction(
3838 this . Name = name ;
3939 this . Kind = kind ;
4040 this . Parameter = parameter ;
41- this . ReturnType = SyntaxNodeUtility . GetRenderedTypeExpression ( returnType , false ) ;
41+ this . ReturnType = returnType != null ? SyntaxNodeUtility . GetRenderedTypeExpression ( returnType , false ) : string . Empty ;
4242 this . ReturnsVoid = returnsVoid ;
4343 }
4444
@@ -63,7 +63,7 @@ public static bool TryParse(SemanticModel model, MethodDeclarationSyntax method,
6363 }
6464
6565 ITypeSymbol ? returnTypeSymbol = model . GetTypeInfo ( returnType ) . Type ;
66- if ( returnTypeSymbol == null )
66+ if ( returnTypeSymbol == null || returnTypeSymbol . TypeKind == TypeKind . Error )
6767 {
6868 function = null ;
6969 return false ;
@@ -144,11 +144,7 @@ public static bool TryParse(SemanticModel model, MethodDeclarationSyntax method,
144144
145145 requiredNamespaces ! . UnionWith ( GetRequiredGlobalNamespaces ( ) ) ;
146146
147- // For void returns, pass a dummy object type since the constructor needs an ITypeSymbol
148- // but the ReturnsVoid flag will ensure it's not actually used for code generation
149- ITypeSymbol returnTypeForConstructor = returnSymbol ?? model . Compilation . GetSpecialType ( SpecialType . System_Object ) ;
150-
151- function = new DurableFunction ( fullTypeName ! , name , kind , parameter , returnTypeForConstructor , returnsVoid , requiredNamespaces ) ;
147+ function = new DurableFunction ( fullTypeName ! , name , kind , parameter , returnSymbol , returnsVoid , requiredNamespaces ) ;
152148 return true ;
153149 }
154150
0 commit comments