[AudioUnit] Simplify code and fix leak in AudioComponent.ComponentList.#24511
Conversation
Contributes towards #17285.
There was a problem hiding this comment.
Pull request overview
This PR simplifies the ComponentList property implementation in AudioComponent and fixes a memory leak by using modern helper methods and TransientCFString for automatic resource management.
Changes:
- Simplified getter using
NSArray.ArrayFromHandlewithreleaseHandle: trueto fix the memory leak - Simplified setter using
NSArray.FromNSObjectswith a converter function andTransientCFStringfor resource management - Updated test to expect
InvalidOperationExceptioninstead ofArgumentNullExceptionwhen settingComponentListto null - Enhanced XML documentation for the
ComponentListproperty
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/AudioUnit/AudioComponent.cs | Refactored ComponentList property getter and setter to use TransientCFString and NSArray helper methods, reducing code complexity and fixing memory leak. Added P/Invoke nullability annotations and improved XML documentation. |
| tests/monotouch-test/AudioToolbox/AudioComponentTest.cs | Updated test expectation from ArgumentNullException to InvalidOperationException when setting ComponentList to null. |
✅ [CI Build #499e77d] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #499e77d] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [CI Build #499e77d] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #499e77d] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #499e77d] Tests on macOS arm64 - Mac Tahoe (26) passed 💻✅ All tests on macOS arm64 - Mac Tahoe (26) passed. Pipeline on Agent |
💻 [CI Build #499e77d] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
💻 [CI Build #499e77d] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #499e77d] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
🚀 [CI Build #499e77d] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 130 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Contributes towards #17285.