Skip to content

Commit f7d5104

Browse files
authored
Annotate SignalR client for native AOT (#56079)
Addresses the following problems: 0. Fix up some infrastructure around TrimmingAttributes to be cleaner. - Don't need to condition when to include them. Just always include them if you need it, and the TFM checks will be done for you. - Remove duplicate, standalone attribute files 1. HubConnection and ReflectionHelper's usage of finding IAsyncEnumerable interface 2. HubConnection's usage of MakeGenericMethod when using a streaming reader (IAsyncEnumerable or ChannelReader). - The only idea I have here is to follow the same approach as we do in DependencyInjection and elsewhere, which is to check for `IsDynamicCodeSupported == false` && `IsValueType` and throw an exception. This enables people to get exceptions during F5, and not only after publishing.
1 parent 7da8180 commit f7d5104

19 files changed

+110
-215
lines changed

eng/TrimmableProjects.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,12 @@
8585
<TrimmableProject Include="Microsoft.AspNetCore.SpaServices.Extensions" />
8686
<TrimmableProject Include="Microsoft.AspNetCore.StaticFiles" />
8787
<TrimmableProject Include="Microsoft.AspNetCore.WebSockets" />
88+
<TrimmableProject Include="Microsoft.AspNetCore.SignalR.Client.Core" />
89+
<TrimmableProject Include="Microsoft.AspNetCore.SignalR.Client" />
90+
<TrimmableProject Include="Microsoft.AspNetCore.Http.Connections.Client" />
8891
<TrimmableProject Include="Microsoft.AspNetCore.Http.Connections.Common" />
8992
<TrimmableProject Include="Microsoft.AspNetCore.Http.Connections" />
93+
<TrimmableProject Include="Microsoft.AspNetCore.SignalR.Protocols.Json" />
9094
<TrimmableProject Include="Microsoft.AspNetCore.SignalR.Common" />
9195
<TrimmableProject Include="Microsoft.AspNetCore.StaticAssets" />
9296
<TrimmableProject Include="Microsoft.AspNetCore.Components.Authorization" />

src/DataProtection/Abstractions/src/Microsoft.AspNetCore.DataProtection.Abstractions.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Microsoft.AspNetCore.DataProtection.IDataProtector</Description>
1616
<ItemGroup>
1717
<Compile Include="..\..\shared\src\*.cs" LinkBase="Shared" />
1818
<Compile Include="$(SharedSourceRoot)WebEncoders\**\*.cs" />
19-
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
20-
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
19+
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
2120
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
2221
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentOutOfRangeThrowHelper.cs" LinkBase="Shared" />
2322
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />

src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
<Compile Include="..\..\shared\src\*.cs" LinkBase="Shared" />
1919
<Compile Include="$(SharedSourceRoot)PlatformAttributes.cs" LinkBase="Shared"
2020
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
21-
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
22-
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
21+
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
2322
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
2423
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
2524
</ItemGroup>

src/DataProtection/Extensions/src/Microsoft.AspNetCore.DataProtection.Extensions.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
<ItemGroup>
1414
<Compile Include="..\..\shared\src\*.cs" LinkBase="Shared" />
15-
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
16-
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
15+
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
1716
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentThrowHelper.cs" LinkBase="Shared" />
1817
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
1918
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />

src/FileProviders/Embedded/src/Microsoft.Extensions.FileProviders.Embedded.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
4444
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentThrowHelper.cs" LinkBase="Shared" />
4545
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
46-
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
47-
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
46+
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
4847
</ItemGroup>
4948
</Project>

src/HealthChecks/HealthChecks/src/Microsoft.Extensions.Diagnostics.HealthChecks.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ Microsoft.Extensions.Diagnostics.HealthChecks.IHealthChecksBuilder
2222
<Compile Include="$(SharedSourceRoot)NonCapturingTimer\*.cs" />
2323
<Compile Include="$(SharedSourceRoot)ValueStopwatch\*.cs" />
2424

25-
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
26-
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
25+
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
2726
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
2827
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
2928
</ItemGroup>

src/Identity/Extensions.Core/src/Microsoft.Extensions.Identity.Core.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
<Reference Include="Microsoft.Extensions.Logging" />
1616
<Reference Include="Microsoft.Extensions.Options" />
1717

18-
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
19-
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
18+
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
2019
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
2120
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ObjectDisposedThrowHelper.cs" LinkBase="Shared" />
2221
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />

src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
<Reference Include="Microsoft.Extensions.Logging" />
1616
<Reference Include="Microsoft.Extensions.Identity.Core" />
1717

18-
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
19-
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
18+
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
2019
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
2120
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ObjectDisposedThrowHelper.cs" LinkBase="Shared" />
2221
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />

src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
<Compile Include="$(SharedSourceRoot)ActivatorUtilities\*.cs" />
2121
<Compile Include="$(SharedSourceRoot)ParameterDefaultValue\*.cs" />
22-
<Compile Include="$(SharedSourceRoot)CodeAnalysis\*.cs" />
2322
<Compile Include="$(SharedSourceRoot)Debugger\DictionaryDebugView.cs" LinkBase="Shared" />
2423
<Compile Include="$(SharedSourceRoot)Debugger\DictionaryItemDebugView.cs" LinkBase="Shared" />
24+
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
2525
</ItemGroup>
2626

2727
<ItemGroup>

src/Shared/CodeAnalysis/DynamicallyAccessedMemberTypes.cs

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

0 commit comments

Comments
 (0)