Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate SignalR client for native AOT #56079

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions eng/TrimmableProjects.props
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@
<TrimmableProject Include="Microsoft.AspNetCore.SpaServices.Extensions" />
<TrimmableProject Include="Microsoft.AspNetCore.StaticFiles" />
<TrimmableProject Include="Microsoft.AspNetCore.WebSockets" />
<TrimmableProject Include="Microsoft.AspNetCore.SignalR.Client.Core" />
<TrimmableProject Include="Microsoft.AspNetCore.SignalR.Client" />
<TrimmableProject Include="Microsoft.AspNetCore.Http.Connections.Client" />
<TrimmableProject Include="Microsoft.AspNetCore.Http.Connections.Common" />
<TrimmableProject Include="Microsoft.AspNetCore.Http.Connections" />
<TrimmableProject Include="Microsoft.AspNetCore.SignalR.Protocols.Json" />
<TrimmableProject Include="Microsoft.AspNetCore.SignalR.Common" />
<TrimmableProject Include="Microsoft.AspNetCore.StaticAssets" />
<TrimmableProject Include="Microsoft.AspNetCore.Components.Authorization" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ Microsoft.AspNetCore.DataProtection.IDataProtector</Description>
<ItemGroup>
<Compile Include="..\..\shared\src\*.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)WebEncoders\**\*.cs" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentOutOfRangeThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
<Compile Include="..\..\shared\src\*.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)PlatformAttributes.cs" LinkBase="Shared"
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

<ItemGroup>
<Compile Include="..\..\shared\src\*.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Microsoft.Extensions.Diagnostics.HealthChecks.IHealthChecksBuilder
<Compile Include="$(SharedSourceRoot)NonCapturingTimer\*.cs" />
<Compile Include="$(SharedSourceRoot)ValueStopwatch\*.cs" />

<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
<Reference Include="Microsoft.Extensions.Logging" />
<Reference Include="Microsoft.Extensions.Options" />

<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ObjectDisposedThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
<Reference Include="Microsoft.Extensions.Logging" />
<Reference Include="Microsoft.Extensions.Identity.Core" />

<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared"
Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ObjectDisposedThrowHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

<Compile Include="$(SharedSourceRoot)ActivatorUtilities\*.cs" />
<Compile Include="$(SharedSourceRoot)ParameterDefaultValue\*.cs" />
<Compile Include="$(SharedSourceRoot)CodeAnalysis\*.cs" />
<Compile Include="$(SharedSourceRoot)Debugger\DictionaryDebugView.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)Debugger\DictionaryItemDebugView.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
</ItemGroup>

<ItemGroup>
Expand Down
99 changes: 0 additions & 99 deletions src/Shared/CodeAnalysis/DynamicallyAccessedMemberTypes.cs

This file was deleted.

50 changes: 0 additions & 50 deletions src/Shared/CodeAnalysis/DynamicallyAccessedMembersAttribute.cs

This file was deleted.

42 changes: 23 additions & 19 deletions src/Shared/TrimmingAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,74 @@

namespace System.Diagnostics.CodeAnalysis;

#if !NET7_0_OR_GREATER
/// <summary>
/// Indicates that the specified method requires dynamic access to code that is not referenced
/// statically, for example through <see cref="System.Reflection"/>.
/// Indicates that the specified method requires the ability to generate new code at runtime,
/// for example through <see cref="System.Reflection"/>.
/// </summary>
/// <remarks>
/// This allows tools to understand which methods are unsafe to call when removing unreferenced
/// code from an application.
/// This allows tools to understand which methods are unsafe to call when compiling ahead of time.
/// </remarks>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)]
internal sealed class RequiresUnreferencedCodeAttribute : Attribute
internal sealed class RequiresDynamicCodeAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="RequiresUnreferencedCodeAttribute"/> class
/// Initializes a new instance of the <see cref="RequiresDynamicCodeAttribute"/> class
/// with the specified message.
/// </summary>
/// <param name="message">
/// A message that contains information about the usage of unreferenced code.
/// A message that contains information about the usage of dynamic code.
/// </param>
public RequiresUnreferencedCodeAttribute(string message)
public RequiresDynamicCodeAttribute(string message)
{
Message = message;
}

/// <summary>
/// Gets a message that contains information about the usage of unreferenced code.
/// Gets a message that contains information about the usage of dynamic code.
/// </summary>
public string Message { get; }

/// <summary>
/// Gets or sets an optional URL that contains more information about the method,
/// why it requires unreferenced code, and what options a consumer has to deal with it.
/// why it requires dynamic code, and what options a consumer has to deal with it.
/// </summary>
public string? Url { get; set; }
}
#endif

#if !NET5_0_OR_GREATER
/// <summary>
/// Indicates that the specified method requires the ability to generate new code at runtime,
/// for example through <see cref="System.Reflection"/>.
/// Indicates that the specified method requires dynamic access to code that is not referenced
/// statically, for example through <see cref="System.Reflection"/>.
/// </summary>
/// <remarks>
/// This allows tools to understand which methods are unsafe to call when compiling ahead of time.
/// This allows tools to understand which methods are unsafe to call when removing unreferenced
/// code from an application.
/// </remarks>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)]
internal sealed class RequiresDynamicCodeAttribute : Attribute
internal sealed class RequiresUnreferencedCodeAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="RequiresDynamicCodeAttribute"/> class
/// Initializes a new instance of the <see cref="RequiresUnreferencedCodeAttribute"/> class
/// with the specified message.
/// </summary>
/// <param name="message">
/// A message that contains information about the usage of dynamic code.
/// A message that contains information about the usage of unreferenced code.
/// </param>
public RequiresDynamicCodeAttribute(string message)
public RequiresUnreferencedCodeAttribute(string message)
{
Message = message;
}

/// <summary>
/// Gets a message that contains information about the usage of dynamic code.
/// Gets a message that contains information about the usage of unreferenced code.
/// </summary>
public string Message { get; }

/// <summary>
/// Gets or sets an optional URL that contains more information about the method,
/// why it requires dynamic code, and what options a consumer has to deal with it.
/// why it requires unreferenced code, and what options a consumer has to deal with it.
/// </summary>
public string? Url { get; set; }
}
Expand Down Expand Up @@ -414,3 +417,4 @@ internal enum DynamicallyAccessedMemberTypes
/// </summary>
All = ~None
}
#endif
Loading
Loading