Skip to content

Commit 0fa9df0

Browse files
authored
Avoid adding dependency on System.Threading.Channels to InteractiveHost (#79594)
1 parent 6c7ade3 commit 0fa9df0

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

src/Dependencies/Threading/ChannelReaderExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if !MICROSOFT_CODEANALYSIS_THREADING_NO_CHANNELS
6+
57
#nullable enable
68

79
using System.Collections.Generic;
@@ -25,3 +27,5 @@ public static async IAsyncEnumerable<T> ReadAllAsync<T>(this ChannelReader<T> re
2527
}
2628
#endif
2729
}
30+
31+
#endif

src/Dependencies/Threading/ProducerConsumer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if !MICROSOFT_CODEANALYSIS_THREADING_NO_CHANNELS
6+
57
#nullable enable
68

79
using System;
@@ -395,3 +397,5 @@ private static async Task PerformActionAndCloseWriterAsync<TArgs>(
395397

396398
#endregion
397399
}
400+
401+
#endif

src/Dependencies/Threading/ProducerConsumerOptions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if !MICROSOFT_CODEANALYSIS_THREADING_NO_CHANNELS
6+
57
#nullable enable
68

79
using System.Threading.Channels;
@@ -32,3 +34,5 @@ internal readonly record struct ProducerConsumerOptions
3234
#endif
3335
public bool SingleReader { get; init; }
3436
}
37+
38+
#endif

src/Interactive/Host/Microsoft.CodeAnalysis.InteractiveHost.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<UseWindowsForms>true</UseWindowsForms>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1010
<GeneratePerformanceSensitiveAttribute>true</GeneratePerformanceSensitiveAttribute>
11+
12+
<!-- Avoid dependency on System.Threading.Channels (unnecessary 32-bit NGEN'd binary) -->
13+
<DefineConstants>$(DefineConstants);MICROSOFT_CODEANALYSIS_THREADING_NO_CHANNELS</DefineConstants>
1114

1215
<!-- NuGet -->
1316
<IsPackable>true</IsPackable>
@@ -55,7 +58,6 @@
5558
add an explicit reference to System.Threading.Tasks.Dataflow to ensure that the correct
5659
BindingRedirect is included in the app.config of InteractiveHost.exe -->
5760
<PackageReference Include="System.Threading.Tasks.Dataflow" />
58-
<PackageReference Include="System.Threading.Channels" />
5961
</ItemGroup>
6062
<ItemGroup>
6163
<EmbeddedResource Update="InteractiveHostResources.resx" GenerateSource="true" />

0 commit comments

Comments
 (0)