ILC emits false-positive trim/AOT warnings when `[FeatureSwitchDefinition]` property is combined with `||`
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Description
When a `[FeatureSwitchDefinition]` property is the left operand of `||`, ILC emits IL2026/IL3050 for the else branch even though it's correctly trimmed at publish time.
```csharp
// No warnings
if (FeatureSwitch) { Safe(); } else { Unsafe(); }
// False-positive IL2026/IL3050 on Unsafe()
if (FeatureSwitch || RuntimeCheck()) { Safe(); } else { Unsafe(); }
```
### Reproduction Steps
https://github.com/Nigusu-Allehu/TestFeatureSwitch
### Expected behavior
I would expect constant folding in the if condition as the value of the runtime check does not matter if the feature switch is `true`.
### Actual behavior
IL2026 and IL3050 warnings from the code path that should have been trimmed out
### Regression?
IDK
### Known Workarounds
expand the if condition
```
if (feature switch)
else
{
if (runtime check)
else
}
```
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.