Trim NetEventSource when EventSource.IsSupported is false by eerhardt · Pull Request #38828 · dotnet/runtime (original) (raw)

Follow up to #38129. NetEventSource code was still left in even when EventSource.IsSupported is false, since all the usages of NetEventSource are keying off its own static property: NetEventSource.IsEnabled.

Remove NetEventSource.IsEnabled so the linker can trim NetEventSource code when EventSource.IsSupported is false.

cc @marek-safar

This trims a little over 8 KB of IL in the CarChecker Blazor app, when EventSource.IsSupported is false.

Build Size
master 3,719,168 bytes
proposed change 3,710,976 bytes