With structured logging the "@" directive can be used to indicate the POCO used for a logging parameter should be json serialized. With structured logging in Native AOT we do a best attempt to serialize. If the serialization fails then fallback to the regular ToString method. Previously the code had a suppression for IL2026 calling out the serialization was a best attempt. For some reason when actually publishing for NativeAOT it also triggers the IL3050 warning that doesn't show up in the normal build despite EnableTrimAnalyzer being enabled.
This PR adds the suppression for IL3050 as well as add a new unit tests that compiles a function with NativeAOT enabled. If any AOT trim warnings are produced during the publish the test fails.
With structured logging the "@" directive can be used to indicate the POCO used for a logging parameter should be json serialized. With structured logging in Native AOT we do a best attempt to serialize. If the serialization fails then fallback to the regular
ToString
method. Previously the code had a suppression forIL2026
calling out the serialization was a best attempt. For some reason when actually publishing for NativeAOT it also triggers theIL3050
warning that doesn't show up in the normal build despiteEnableTrimAnalyzer
being enabled.This PR adds the suppression for
IL3050
as well as add a new unit tests that compiles a function with NativeAOT enabled. If any AOT trim warnings are produced during the publish the test fails.