dotnet / linker

387 stars 134 forks source link

[release/7.0] Port of stability fixes for trimmer and anlyzer #3234

Open vitek-karas opened 9 months ago

vitek-karas commented 9 months ago

[!NOTE] This says release/7.0 but is actually a backport to 6.0 because the 7.0 linker is used for <= 7.0.

Customer Impact

These are all crashes/hangs. Each of these has been customer reported in .NET 8, although we have only received a customer issue for the first one in .NET 7. The theory here is that these were somewhat hard to track down and led to a bad customer experience (build hangs), and if we would backport one, it's probably worth it to backport all. We can separate each of them if necessary. The analyzer crash (third in the list) will almost certainly occur if someone tries to use a new language version while sticking on an old framework. This hasn't been common yet, but we guess that it will become more so over time.

  This ports these PR (at least the parts relevant to trimmer and analyzer) from 8.0:

See the specific commits for a bit more detail on the ports.

Testing

The change adds tests for the first two changes. Adding tests for the 3rd is difficult (how to introduce unknown code patterns - if don't know what they are).

Risk

Pretty low. Only to trim scenarios. All of these changes simply detect pathological cases and turn them into much simpler state which is not going to harm the analysis.