Skip to content

Commit 8dc496f

Browse files
committed
Fix test
1 parent c8efc06 commit 8dc496f

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

CodeJam.Main/Targeting/MethodImplOptionsEx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace CodeJam.Targeting
55
/// <summary>Extended <see cref="MethodImplOptions"/></summary>
66
internal static class MethodImplOptionsEx
77
{
8-
/// <summary>MethodImplOptions.AggressiveInlining or explicit value if not supported by target platform to allow inlining when running on higher framework</summary>
8+
/// <summary>MethodImplOptions.AggressiveInlining or explicit value if not supported by target platform to allow inlining when running on higher framework.</summary>
99
#if NET45_OR_GREATER || TARGETS_NETSTANDARD || TARGETS_NETCOREAPP
1010
public const MethodImplOptions AggressiveInlining = MethodImplOptions.AggressiveInlining;
1111
#else
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Threading.Tasks;
2+
3+
namespace CodeJam.Targeting
4+
{
5+
/// <summary>Extended <see cref="TaskCreationOptions"/></summary>
6+
internal static class TaskCreationOptionsEx
7+
{
8+
/// <summary>TaskCreationOptions.RunContinuationsAsynchronously or explicit value if not supported by target platform.</summary>
9+
#if NET46_OR_GREATER || TARGETS_NETSTANDARD || TARGETS_NETCOREAPP
10+
public const TaskCreationOptions RunContinuationsAsynchronously = TaskCreationOptions.RunContinuationsAsynchronously;
11+
#else
12+
public const TaskCreationOptions RunContinuationsAsynchronously = (TaskCreationOptions)64;
13+
#endif
14+
}
15+
}

CodeJam.Main/Threading/TaskHelper.NonGenerated.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using System.Threading;
33
using System.Threading.Tasks;
44

5+
using CodeJam.Targeting;
6+
57
using JetBrains.Annotations;
68

79
#if NET45_OR_GREATER || TARGETS_NETSTANDARD || TARGETS_NETCOREAPP
@@ -121,17 +123,17 @@ public static async Task WaitForCancellationAsync(this CancellationToken cancell
121123
}
122124

123125
/// <summary>
124-
/// Creates safe for await <see cref="TaskCompletionSource{TResult}"/> with <see cref="TaskCreationOptions.RunContinuationsAsynchronously"/> mode.
126+
/// Creates safe for await <see cref="TaskCompletionSource{TResult}"/> with <see cref="TaskCreationOptionsEx.RunContinuationsAsynchronously"/> mode.
125127
/// See https://devblogs.microsoft.com/premier-developer/the-danger-of-taskcompletionsourcet-class/ for explanation.
126128
/// </summary>
127129
public static TaskCompletionSource<T> CreateAsyncTaskSource<T>() =>
128-
new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
130+
new TaskCompletionSource<T>(TaskCreationOptionsEx.RunContinuationsAsynchronously);
129131

130132
/// <summary>
131-
/// Creates safe for await <see cref="TaskCompletionSource{TResult}"/> with <see cref="TaskCreationOptions.RunContinuationsAsynchronously"/> mode.
133+
/// Creates safe for await <see cref="TaskCompletionSource{TResult}"/> with <see cref="TaskCreationOptionsEx.RunContinuationsAsynchronously"/> mode.
132134
/// See https://devblogs.microsoft.com/premier-developer/the-danger-of-taskcompletionsourcet-class/ for explanation.
133135
/// </summary>
134136
public static TaskCompletionSource<T> CreateAsyncTaskSource<T>(TaskCreationOptions creationOptions) =>
135-
new TaskCompletionSource<T>(creationOptions | TaskCreationOptions.RunContinuationsAsynchronously);
137+
new TaskCompletionSource<T>(creationOptions | TaskCreationOptionsEx.RunContinuationsAsynchronously);
136138
}
137139
}

0 commit comments

Comments
 (0)