What is il trimming?
Trimming removes IL that is not statically reachable. Apps that use reflection or other patterns that create dynamic dependencies may be broken by trimming. To warn about such patterns, set <SuppressTrimAnalysisWarnings> to false .
How to set Legacy_cardinality_estimation on?
Setting LEGACY_CARDINALITY_ESTIMATION to ON is equivalent to enabling Trace Flag 9481. To accomplish this at the query level, add the QUERYTRACEON query hint. Starting with SQL Server 2016 (13. x) SP1, to accomplish this at the query level, add the USE HINT query hint instead of using the trace flag.