Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's one trim warning that the analyzer didn't catch (bug) that the
AOT compiler does. Unfortunately, the warning isn't easily resolvable --
it implies that you can no longer use deconstructed compiler-generated
types (like anonymous types) through the various logging calls.
There's unfortunately no way to perfectly resolve this. This PR proposes
a behavioral change for trimming -- when trimming, compiler-generated
types will be logged like scalars, instead of being deconstructed. This
is not ideal. Libraries should not have significantly different behavior
when trimming without a warning or some other diagnostic being produced.
Unfortunately, the contract implied by the existing code is much too
complicated to be encoded in the trimmer. The contract is that types do
not need to preserve reflection metadata, except for compiler-generated
types, which need public properties. However, the definition of
compiler-generated types is not well-defined. Encoding a heuristic in
Serilog is one thing -- encoding the heuristic in the .NET runtime is
another.
Given the constraints, this seems like the best option.