Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RGen] Fix an issue with the GC.KeepAlive analyzer. #22463

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

mandel-macaque
Copy link
Member

The analyzer returns a lot of false positives for a very common usage pattern in the generated code:

if (foo) {
  XMethod (x.Handle);
} else {
  YMethod (x.Handle);
}
GC.KeepAlive (x);

This change takes into account this pattern and ignores those false positives. The code is not a general solution, it just accounts for a very well known pattern.

The analyzer returns a lot of false positives for a very common usage
pattern in the generated code:

```csharp
if (foo) {
  XMethod (x.Handle);
} else {
  YMethod (x.Handle);
}
GC.KeepAlive (x);
```

This change takes into account this pattern and ignores those false
positives. The code is not a general solution, it just accounts for a
very well known pattern.
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #a5c1fc8] Build passed (Build packages) ✅

Pipeline on Agent
Hash: a5c1fc8a173d5ea6cddadf9ff737592a11991bee [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #a5c1fc8] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: a5c1fc8a173d5ea6cddadf9ff737592a11991bee [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #a5c1fc8] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: a5c1fc8a173d5ea6cddadf9ff737592a11991bee [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #a5c1fc8] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: a5c1fc8a173d5ea6cddadf9ff737592a11991bee [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #a5c1fc8] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: a5c1fc8a173d5ea6cddadf9ff737592a11991bee [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #a5c1fc8] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: a5c1fc8a173d5ea6cddadf9ff737592a11991bee [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #a5c1fc8] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: a5c1fc8a173d5ea6cddadf9ff737592a11991bee [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

❗ API diff vs stable (Breaking changes)

.NET ( ❗ Breaking changes ❗ )

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: a5c1fc8a173d5ea6cddadf9ff737592a11991bee [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #a5c1fc8] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 2 tests failed, 115 tests passed.

Failures

❌ linker tests

1 tests failed, 43 tests passed.
  • trimmode link/tvOS - simulator/Debug: Failed

Html Report (VSDrops) Download

❌ monotouch tests (macOS)

1 tests failed, 8 tests passed.
  • monotouch-test/macOS/Debug (managed static registrar): Failed (Test run failed.
    Tests run: 3142 Passed: 3037 Inconclusive: 7 Failed: 1 Ignored: 104)

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 10 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 8 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: a5c1fc8a173d5ea6cddadf9ff737592a11991bee [PR build]

@rolfbjarne rolfbjarne changed the title [RGen] Fix an issue with the GC.KeepAlife analyzer. [RGen] Fix an issue with the GC.KeepAlive analyzer. Mar 25, 2025
@mandel-macaque
Copy link
Member Author

Failures are unrelated to the change.

@mandel-macaque mandel-macaque merged commit 061870a into main Mar 25, 2025
44 of 47 checks passed
@mandel-macaque mandel-macaque deleted the dev/mandel/analyzer-if-else branch March 25, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants