Skip to content

Commit 4f957cc

Browse files
committed
Use official Roslyn NuGet package
1 parent ad96467 commit 4f957cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+169
-125
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ syntax: glob
1111
.packages
1212
.tools
1313

14-
# nuget packages for custom roslyn
15-
roslynpackages
16-
1714
# User-specific files
1815
*.suo
1916
*.user

NuGet.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<add key="dotnet-libraries-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries-transport/nuget/v3/index.json" />
2020
<add key="dotnet10" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json" />
2121
<add key="dotnet10-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10-transport/nuget/v3/index.json" />
22-
<add key="async-compiler" value="roslynpackages" />
22+
<add key="general-testing" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json" />
2323
</packageSources>
2424
<auditSources>
2525
<clear />

buildroslynnugets.cmd

Lines changed: 0 additions & 34 deletions
This file was deleted.

eng/Versions.props

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@
4444
Any tools that contribute to the design-time experience should use the MicrosoftCodeAnalysisVersion_LatestVS property above to ensure
4545
they do not break the local dev experience.
4646
-->
47-
<MicrosoftCodeAnalysisCSharpVersion>4.14.0-async-15</MicrosoftCodeAnalysisCSharpVersion>
48-
<MicrosoftCodeAnalysisVersion>4.14.0-async-15</MicrosoftCodeAnalysisVersion>
49-
<MicrosoftNetCompilersToolsetVersion>4.14.0-async-15</MicrosoftNetCompilersToolsetVersion>
47+
48+
<MicrosoftCodeAnalysisCSharpVersion>4.13.0-3.24611.10</MicrosoftCodeAnalysisCSharpVersion>
49+
<MicrosoftCodeAnalysisVersion>$(MicrosoftCodeAnalysisCSharpVersion)</MicrosoftCodeAnalysisVersion>
50+
<MicrosoftNetCompilersToolsetVersion>$(MicrosoftCodeAnalysisCSharpVersion)</MicrosoftNetCompilersToolsetVersion>
5051
</PropertyGroup>
5152
<!--
5253
For source generator support we need to target multiple versions of Roslyn in order to be able to run on older versions of Roslyn.

src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,31 @@ public static partial class RuntimeFeature
4747
/// </summary>
4848
public const string NumericIntPtr = nameof(NumericIntPtr);
4949

50+
/// <summary>
51+
/// Indicates that this version of the runtime supports async methods.
52+
/// </summary>
53+
[RequiresPreviewFeatures]
54+
public const string Async = nameof(Async);
55+
5056
/// <summary>
5157
/// Checks whether a certain feature is supported by the Runtime.
5258
/// </summary>
5359
public static bool IsSupported(string feature)
5460
{
5561
return feature switch
5662
{
57-
PortablePdb or CovariantReturnsOfClasses or ByRefFields or ByRefLikeGenerics or UnmanagedSignatureCallingConvention or DefaultImplementationsOfInterfaces or VirtualStaticsInInterfaces or NumericIntPtr => true,
63+
PortablePdb or
64+
CovariantReturnsOfClasses or
65+
ByRefFields or
66+
ByRefLikeGenerics or
67+
UnmanagedSignatureCallingConvention or
68+
DefaultImplementationsOfInterfaces or
69+
VirtualStaticsInInterfaces or
70+
NumericIntPtr or
71+
#pragma warning disable CA2252 // Using preview features
72+
Async=> true,
73+
#pragma warning restore CA2252 // Using preview features
74+
5875
nameof(IsDynamicCodeSupported) => IsDynamicCodeSupported,
5976
nameof(IsDynamicCodeCompiled) => IsDynamicCodeCompiled,
6077
_ => false,

src/libraries/System.Runtime/ref/System.Runtime.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13785,6 +13785,8 @@ public static partial class RuntimeFeature
1378513785
public const string PortablePdb = "PortablePdb";
1378613786
public const string UnmanagedSignatureCallingConvention = "UnmanagedSignatureCallingConvention";
1378713787
public const string VirtualStaticsInInterfaces = "VirtualStaticsInInterfaces";
13788+
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute]
13789+
public const string Async = "Async";
1378813790
[System.Diagnostics.CodeAnalysis.FeatureGuardAttribute(typeof(System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute))]
1378913791
public static bool IsDynamicCodeCompiled { get { throw null; } }
1379013792
[System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute("System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported")]

src/tests/Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
<Import Project="$(MSBuildThisFileDirectory)\Common\dir.sdkbuild.props" Condition="'$(UsingMicrosoftNETSdk)' == 'true'" />
99
<Import Project="$(MSBuildThisFileDirectory)\Common\dir.common.props" Condition="'$(UsingMicrosoftNETSdk)' != 'true'" />
1010

11+
<PropertyGroup>
12+
<!-- Override the compiler version with a private build that supports async2 -->
13+
<MicrosoftNetCompilersToolsetVersion>4.14.0-3.25170.6</MicrosoftNetCompilersToolsetVersion>
14+
</PropertyGroup>
15+
1116
<PropertyGroup>
1217
<RunningOnUnix Condition="('$(RunningOnUnix)' == '') And ('$(MSBuildRuntimeType)' == 'Core') And ('$(OS)'!='Windows_NT')">true</RunningOnUnix>
1318
</PropertyGroup>

src/tests/async/Directory.Build.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
<Import Project="../Directory.Build.props" />
3+
<PropertyGroup>
4+
<Features>$(Features);runtime-async=on</Features>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<Compile Include="$(MSBuildThisFileDirectory)RuntimeAsyncMethodGenerationAttribute.cs" />
8+
</ItemGroup>
9+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace System.Runtime.CompilerServices;
2+
[AttributeUsage(AttributeTargets.Method)]
3+
public class RuntimeAsyncMethodGenerationAttribute(bool runtimeAsync) : Attribute
4+
{
5+
public bool RuntimeAsync { get; } = runtimeAsync;
6+
}

src/tests/async/awaitingnotasync.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Runtime.CompilerServices;
5-
using System.Runtime.InteropServices;
65
using System.Threading.Tasks;
76
using Xunit;
87

@@ -14,13 +13,15 @@ public static void TestEntryPoint()
1413
AsyncEntryPoint().Wait();
1514
}
1615

16+
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(false)]
1717
private static async Task<T> GetTask<T>(T arg)
1818
{
1919
await Task.Yield();
2020
return arg;
2121
}
2222

2323
// TODO: switch every other scenario to use ValueTask
24+
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(false)]
2425
private static async ValueTask<T> GetValueTask<T>(T arg)
2526
{
2627
await Task.Yield();
@@ -33,13 +34,13 @@ private static async ValueTask<T> GetValueTask<T>(T arg)
3334

3435
private static T sIdentity<T>(T arg) => arg;
3536

36-
private static async2 Task AsyncEntryPoint()
37+
private static async Task AsyncEntryPoint()
3738
{
3839
// static field
3940
sField = GetTask(5);
4041
Assert.Equal(5, await sField);
4142

42-
// property
43+
// property
4344
Assert.Equal(6, await sProp);
4445

4546
// generic identity

src/tests/async/collectible-alc.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void TestEntryPoint()
1717
AsyncEntryPoint().Wait();
1818
}
1919

20-
private static async2 Task AsyncEntryPoint()
20+
private static async Task AsyncEntryPoint()
2121
{
2222
WeakReference wr = await CallFooAsyncAndUnload();
2323

@@ -31,7 +31,7 @@ private static async2 Task AsyncEntryPoint()
3131
}
3232

3333
[MethodImpl(MethodImplOptions.NoInlining)]
34-
private static async2 Task<WeakReference> CallFooAsyncAndUnload()
34+
private static async Task<WeakReference> CallFooAsyncAndUnload()
3535
{
3636
TaskCompletionSource tcs = new();
3737
(Task<string> task, WeakReference wr) = CallFooAsyncInCollectibleALC(tcs.Task);
@@ -63,7 +63,7 @@ private static (Task<string>, WeakReference) CallFooAsyncInCollectibleALC(Task t
6363
}
6464

6565
// Task[] to work around a compiler bug
66-
private static async2 Task<string> FooAsync(Task[] t)
66+
private static async Task<string> FooAsync(Task[] t)
6767
{
6868
await t[0];
6969
return "done";

src/tests/async/collectible-alc.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<!-- For collectible ALC -->
44
<RequiresProcessIsolation>True</RequiresProcessIsolation>
55
<Optimize>True</Optimize>
6+
<Features>$(Features);runtime-async</Features>
67
</PropertyGroup>
78
<ItemGroup>
89
<Compile Include="$(MSBuildProjectName).cs" />

src/tests/async/cse-array-index-byref.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ public static void TestEntryPoint()
1616
Assert.Equal(199_990_000, arr[0]);
1717
}
1818

19+
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(false)]
1920
private static async Task AsyncTestEntryPoint(int[] arr, int index)
2021
{
2122
await HoistedByref(arr, index);
2223
}
2324

2425
[MethodImpl(MethodImplOptions.NoInlining)]
25-
private static async2 Task<int> HoistedByref(int[] arr, int index)
26+
private static async Task<int> HoistedByref(int[] arr, int index)
2627
{
2728
for (int i = 0; i < 20000; i++)
2829
{

src/tests/async/eh-microbench.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public static int Main()
2424
return 100;
2525
}
2626

27+
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(false)]
2728
public static async Task AsyncEntry()
2829
{
2930
if (!GCSettings.IsServerGC)
@@ -68,6 +69,7 @@ public static async Task AsyncEntry()
6869
await RunBench(yieldFrequency, depth, finallyRate, throwOrReturn, "ValueTask");
6970
}
7071

72+
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(false)]
7173
private static async Task RunBench(int yieldCount, int depth, int finallyRate, bool throwOrReturn, string type)
7274
{
7375

@@ -104,7 +106,7 @@ public Benchmark(int yieldCount, int depth, int finallyRate, bool throwOrReturn)
104106
_throwOrReturn = throwOrReturn;
105107
}
106108

107-
public async2 Task<long> Run(string type)
109+
public async Task<long> Run(string type)
108110
{
109111
if (type == "Async2")
110112
return await RunAsync2(_depth);
@@ -117,6 +119,7 @@ public async2 Task<long> Run(string type)
117119
return 0;
118120
}
119121

122+
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(false)]
120123
public async Task<long> RunTask(int depth)
121124
{
122125
int liveState1 = depth * 3 + _yieldCount;
@@ -182,6 +185,7 @@ public async Task<long> RunTask(int depth)
182185
return result;
183186
}
184187

188+
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(false)]
185189
public async ValueTask<long> RunValueTask(int depth)
186190
{
187191
int liveState1 = depth * 3 + _yieldCount;
@@ -267,7 +271,7 @@ public class FakeThread
267271
// This case is used to test the impact of save/restore of the sync and execution context on performance
268272
// The intent here is to measure what the performance impact of maintaining the current async semantics with
269273
// the new implementation.
270-
public async2 Task<long> RunAsync2WithContextSaveRestore(int depth)
274+
public async Task<long> RunAsync2WithContextSaveRestore(int depth)
271275
{
272276
FakeThread thread = CurrentThread;
273277
if (thread == null)
@@ -361,7 +365,7 @@ public async2 Task<long> RunAsync2WithContextSaveRestore(int depth)
361365
}
362366
}
363367

364-
public async2 Task<long> RunAsync2(int depth)
368+
public async Task<long> RunAsync2(int depth)
365369
{
366370
int liveState1 = depth * 3 + _yieldCount;
367371
int liveState2 = depth;

src/tests/async/fibonacci-with-yields.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System;
5+
using System.Runtime.CompilerServices;
56
using System.Threading.Tasks;
67
using System.Diagnostics;
78
using Xunit;
@@ -22,7 +23,7 @@ public static void Test()
2223
System.Console.WriteLine("allocated: " + allocated);
2324
}
2425

25-
public static async2 Task AsyncEntry()
26+
public static async Task AsyncEntry()
2627
{
2728
for (int i = 0; i < iterations; i++)
2829
{
@@ -34,7 +35,7 @@ public static async2 Task AsyncEntry()
3435
}
3536
}
3637

37-
static async2 Task<int> Fib(int i)
38+
static async Task<int> Fib(int i)
3839
{
3940
if (i <= 1)
4041
{

src/tests/async/fibonacci-with-yields.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Optimize>True</Optimize>
4+
<Features>$(Features);runtime-async</Features>
45
</PropertyGroup>
56
<ItemGroup>
67
<Compile Include="$(MSBuildProjectName).cs" />

src/tests/async/fibonacci-with-yields_struct_return.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public struct MyInt
3434
public MyInt(int i) => this.i = i;
3535
}
3636

37-
public static async2 Task AsyncEntry()
37+
public static async Task AsyncEntry()
3838
{
3939
for (int i = 0; i < iterations; i++)
4040
{
@@ -46,7 +46,7 @@ public static async2 Task AsyncEntry()
4646
}
4747
}
4848

49-
static async2 Task<MyInt> Fib(MyInt n)
49+
static async Task<MyInt> Fib(MyInt n)
5050
{
5151
int i = n.i;
5252
if (i <= 1)

src/tests/async/fibonacci-with-yields_struct_return.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Optimize>True</Optimize>
4+
<Features>$(Features);runtime-async</Features>
45
</PropertyGroup>
56
<ItemGroup>
67
<Compile Include="$(MSBuildProjectName).cs" />

src/tests/async/fibonacci-without-yields.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void Test()
2222
System.Console.WriteLine("allocated: " + allocated);
2323
}
2424

25-
public static async2 Task AsyncEntry()
25+
public static async Task AsyncEntry()
2626
{
2727
for (int i = 0; i < iterations; i++)
2828
{
@@ -34,7 +34,7 @@ public static async2 Task AsyncEntry()
3434
}
3535
}
3636

37-
static async2 Task<int> Fib(int i)
37+
static async Task<int> Fib(int i)
3838
{
3939
if (i <= 1)
4040
{

src/tests/async/fibonacci-without-yields.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Optimize>True</Optimize>
4+
<Features>$(Features);runtime-async</Features>
45
</PropertyGroup>
56
<ItemGroup>
67
<Compile Include="$(MSBuildProjectName).cs" />

src/tests/async/gc-roots-scan.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class Async2RootReporting
1111
private static TaskCompletionSource<int> cs;
1212

1313

14+
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(false)]
1415
static async Task<int> Recursive1(int n)
1516
{
1617
Task<int> cTask = cs.Task;
@@ -50,7 +51,7 @@ static async Task<int> Recursive1(int n)
5051
return result;
5152
}
5253

53-
static async2 Task<int> Recursive2(int n)
54+
static async Task<int> Recursive2(int n)
5455
{
5556
Task<int> cTask = cs.Task;
5657

0 commit comments

Comments
 (0)