File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 1
1
using System . Collections . ObjectModel ;
2
+ using Microsoft . VisualStudio . Threading ;
2
3
3
4
namespace ICSharpCode . CodeConverter . Common ;
4
5
@@ -90,7 +91,13 @@ public static IEnumerable<T> Yield<T>(this T singleElement)
90
91
yield return singleElement ;
91
92
}
92
93
93
- public static async Task < IEnumerable < T > > YieldAsync < T > ( this Task < T > task ) => ( await task ) . Yield ( ) ;
94
+ public static async Task < IEnumerable < T > > YieldAsync < T > ( this Task < T > task )
95
+ {
96
+ await TaskScheduler . Default ;
97
+ #pragma warning disable VSTHRD003 // Avoid awaiting foreign Tasks - We've just switched away from the main thread so can't deadlock
98
+ return ( await task ) . Yield ( ) ;
99
+ #pragma warning restore VSTHRD003 // Avoid awaiting foreign Tasks
100
+ }
94
101
95
102
public static IEnumerable < T > YieldNotNull < T > ( this T singleElement )
96
103
{
You can’t perform that action at this time.
0 commit comments