Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Improve workaround #8

Merged
merged 4 commits into from
Nov 15, 2023
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
14 changes: 14 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!--
Suppress warnings until https://github.com/dotnet/extensions/issues/4622 is resolved
-->
<Project>
<PropertyGroup>
<NoWarn>$(NoWarn);IL2026</NoWarn>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
</PropertyGroup>
<Target Name="SuppressDotNetExtensionsWarnings" BeforeTargets="PrepareForILLink">
<ItemGroup>
<IlcArg Include="--singlewarnassembly:Microsoft.Extensions.Http.Resilience" />
</ItemGroup>
</Target>
</Project>
2 changes: 0 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Polly.Core" Version="8.2.0" />
<PackageVersion Include="Polly.Extensions" Version="8.2.0" />
<PackageVersion Include="Polly.RateLimiting" Version="8.2.0" />
<PackageVersion Include="xunit" Version="2.6.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
Expand Down
6 changes: 1 addition & 5 deletions src/WeatherApi/WeatherApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@
<EnableRequestDelegateGenerator>true</EnableRequestDelegateGenerator>
</PropertyGroup>
<!-- Add support for Ahead-of-Time (AoT) compilation -->
<PropertyGroup Condition="!$([System.OperatingSystem]::IsMacOS())">
<PropertyGroup>
<InvariantGlobalization>true</InvariantGlobalization>
<!-- HACK Suppress IL warnings from Microsoft.Extensions.Http.Resilience until 8.0.0 -->

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to disable warnings coming from a specific set of libraries, a strategy I found that works is to use <TrimmerSingleWarn>false</TrimmerSingleWarn> and disable the warning for IL2104 (the warning number for a single warning for a whole library).

And then turn on "single warnings" for the specific libraries you want to suppress. You can see an example of that here:
https://github.com/dotnet/eShop/blob/1e803b09ba8caa3702f037deac837fab956abe33/Directory.Build.targets#L7-L23

<NoWarn>$(NoWarn);IL2026;IL2104</NoWarn>
<PublishAot>true</PublishAot>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Resilience" />
<PackageReference Include="Polly.Core" />
<PackageReference Include="Polly.Extensions" />
<PackageReference Include="Polly.RateLimiting" />
</ItemGroup>
</Project>