diff --git a/src/coreclr/jit/fgopt.cpp b/src/coreclr/jit/fgopt.cpp index 0ac687cd734153..547688a959c4da 100644 --- a/src/coreclr/jit/fgopt.cpp +++ b/src/coreclr/jit/fgopt.cpp @@ -5583,8 +5583,18 @@ bool Compiler::gtTreeContainsAsyncCall(GenTree* tree) return false; } - auto isAsyncCall = [](GenTree* tree) { - return tree->IsCall() && tree->AsCall()->IsAsync(); + auto isAsyncCall = [=](GenTree* tree) { + if (tree->IsCall() && tree->AsCall()->IsAsync()) + { + return true; + } + + if (tree->OperIs(GT_RET_EXPR) && gtTreeContainsAsyncCall(tree->AsRetExpr()->gtInlineCandidate)) + { + return true; + } + + return false; }; return gtFindNodeInTree(tree, isAsyncCall) != nullptr; diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index bc3aaef2046d2f..0e20f7f99303c0 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -1,4 +1,8 @@  + + $(Features);runtime-async=on + + true diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 46da7b2e28340f..73e36cf5b0035b 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -99,4 +99,9 @@ + + $(Features);runtime-async=on + $(NoWarn);xUnit1013;CS1998;SYSLIB5007 + +