Skip to content

Commit

Permalink
Suppress IL3000 in MsQuicApi constructor (#109965)
Browse files Browse the repository at this point in the history
A call to `Assembly.Location` was added in a recent fix. It has `IL30000` suppressed via `#pragma warning disable`, but that only applies to the compilation of the library itself. Consumers will hit it when doing something like publishing their app as NativeAOT.

This change adds an `[UnconditionalSuppressMessage]` to the `MsQuicApi` static constructor such that `IL30000` should also be suppressed for apps consuming the runtime.

This was caught in an aspnetcore deps flow PR coming from runtime.

Co-authored-by: Elinor Fung <[email protected]>
  • Loading branch information
rzikm and elinor-fung authored Nov 25, 2024
1 parent 315a900 commit 36320b3
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ private MsQuicApi(QUIC_API_TABLE* apiTable)
internal static bool Tls13ClientMayBeDisabled { get; }

#pragma warning disable CA1810 // Initialize all static fields in 'MsQuicApi' when those fields are declared and remove the explicit static constructor
[UnconditionalSuppressMessage("SingleFile", "IL3000: Avoid accessing Assembly file path when publishing as a single file",
Justification = "The code handles the Assembly.Location being null/empty by falling back to AppContext.BaseDirectory")]
static MsQuicApi()
{
bool loaded = false;
Expand Down

0 comments on commit 36320b3

Please sign in to comment.