[AI Task] Fix package size query async hang, inline continuations, and callback dict leak - #7839
Open
JoonghyunCho wants to merge 2 commits into
Open
JoonghyunCho wants to merge 2 commits into
JoonghyunCho wants to merge 2 commits into
Conversation
…ck dict leak (Fixes #7770) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
|
|
JoonghyunCho
commented
Sep 13, 2026
| { | ||
| _packageManagerSizeInfoCallbackDict.Remove(callbackId); | ||
| } | ||
| tcs.TrySetException(PackageManagerErrorFactory.GetException(err, "Failed to get total package size info of " + Id)); |
Member
Author
There was a problem hiding this comment.
🤖 [AI Review]
🟡 Suggestion: This is the per-package query — "total" is copied from GetTotalSizeInformationAsync and makes the failure message misleading, worth fixing while this error path is being touched.
Suggested change
| tcs.TrySetException(PackageManagerErrorFactory.GetException(err, "Failed to get total package size info of " + Id)); | |
| tcs.TrySetException(PackageManagerErrorFactory.GetException(err, "Failed to get package size info of " + Id)); |
Remove misleading "total" from the per-package size query failure message in Package.GetSizeInformationAsync Applied-AI-Comments: 4001195337
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three defects shared by the two asynchronous package-size query methods, per the analysis in #7770:
awaithang: the native callback completed theTaskCompletionSourceonly on the success branch. When the native layer reported failure (IntPtr.Zerohandle, or a package-ID mismatch in the instance variant), the returnedTasknever completed. The failure branch now faults the task withInvalidOperationException.TaskCreationOptions.RunContinuationsAsynchronously, matching the fixes already applied across the WiFi/Bluetooth/NFC/Remoting/IoTConnectivity bindings.callbackId → delegatedictionary entry was registered before the P/Invoke call but removed only inside the callback, which never fires when the P/Invoke itself returns an error. The error path now removes the entry under the lock before faulting the task. InGetTotalSizeInformationAsyncthe dictionary is static, so this leak was process-lifetime.Changes
src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs:GetSizeInformationAsync— TCS withRunContinuationsAsynchronously,elsebranch faulting the task, dict entry removal on the synchronous error path.src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs:GetTotalSizeInformationAsync— identical three-part fix againsts_totalSizeInfoCallbackDict.Mode
Refactoring
Verification
dotnet build src/Tizen.Applications.PackageManager/Tizen.Applications.PackageManager.csproj, 0 errors; all warnings pre-existing on unrelated lines)Public API signatures are unchanged; the success path is byte-for-byte identical. The only behavior change is that a native-callback failure now faults the task deterministically instead of hanging forever — strictly a bug fix.
Fixes #7770