Repository navigation
Conversation
bkonyi
pushed a commit
that referenced
this pull request
Feb 2, 2026
Instead of using fake touch events. Before this patch `FlutterViewController` sends two fake touch events (down and up), at `(0, 0)` to the framework to signal that the status bar is tapped on iOS. The scaffold widget and the cupertino page scaffold widget set up gesture detectors to listen for these fake taps, and scroll the "primary" scrollable container to the top in response. This messaging mechanism is sometimes ambiguous, as the framework may interpret that as a pair of regular pointer tap events (for instance in flutter#177992 the modal barrier claims the tap gesture and as a result the modal barrier is dismissed by the fake touch events). This PR changes that to communicate the status bar tap event via a new system channel, and dispatch the events via `WidgetsBindingObserver`s in the framework. See also flutter#177992 (comment) Fixes flutter#177992, fixes flutter#175606 It appears that UIKit also has access to the coordinates of the touch events to determine which scrollable view(s?) to dispatch the scroll to top event to. ```objc * frame #0: 0x00000001032f6520 UIPlayground.debug.dylib`MyScrollViewController.scrollViewShouldScrollToTop(scrollView=0x0000000106014800) at UIScrollView.swift:13:3 frame #2: 0x00000001867c9300 UIKitCore`-[UIScrollView _scrollToTopIfPossible:] + 316 frame #3: 0x00000001867c9604 UIKitCore`-[UIScrollView _scrollToTopFromTouchAtScreenLocation:resultHandler:] + 40 frame #4: 0x0000000186299bbc UIKitCore`__71-[UIWindow _scrollToTopViewsUnderScreenPointIfNecessary:resultHandler:]_block_invoke.358 + 168 frame #5: 0x000000018629981c UIKitCore`-[UIWindow _scrollToTopViewsUnderScreenPointIfNecessary:resultHandler:] + 1212 frame #6: 0x000000018581ed8c UIKitCore`-[UIStatusBarManager _handleScrollToTopAtXPosition:] + 192 frame flutter#7: 0x000000018581eb60 UIKitCore`-[UIStatusBarManager handleTapAction:] + 60 ``` Unfortunately that information is not available to user application. The iOS accessibility bridge currently does create dummy UIScrollViews for each scrollable in the accessibility tree so may be we can take advantage of that in the future. ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
bkonyi
pushed a commit
that referenced
this pull request
May 20, 2026
This patch: 1. Updates the `-mios-simulator-version-min` ldflag to `15.0` (this fixes the crash during test discovery). 2. refactors swiftc.py a bit, moves the target triplet logic from darwin/BUILD.gn to swiftc.py so you can override the ios version in a test target (but it's not absolutely necessary for this change since it's the linker flag that makes the difference). 3. Migrates a few xctest tests to swift testing tests. The names of the tests are kept as-is so the diff is easier to read. ### The Crash ``` (lldb) bt * thread flutter#9, name = '[Swift Testing] test discovery - loading test #0 (Task 3)', queue = 'com.apple.root.user-initiated-qos.cooperative', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) * frame #0: 0x0000000000000000 frame #1: 0x000000010ad0fb80 libios_test_flutter.dylib`closure #1() in variable initialization expression of static AccessibilityFeaturesTests.$s22ios_test_flutter_swift26AccessibilityFeaturesTestsV43accessibilityFeatureFlagRawValuesAreCorrect4TestfMp_24accessorc8120add5c86a9e3fMu_ at @__swiftmacro_22ios_test_flutter_swift26AccessibilityFeaturesTestsV43accessibilityFeatureFlagRawValuesAreCorrect4TestfMp_.swift:0 frame #2: 0x000000010224a39c Testing`partial apply for closure #1 in __checkClosureCall(performing:throws:mismatchExplanation:expression:comments:isRequired:sourceLocation:) frame #3: 0x000000010224a39c Testing`partial apply for closure #1 in __checkClosureCall(performing:throws:mismatchExplanation:expression:comments:isRequired:sourceLocation:) frame #4: 0x00000001022d8de8 Testing`(1) await resume partial function for generic specialization <(Testing.Test, Testing.Runner.Plan.Action)> of reabstraction thunk helper <τ_0_0 where τ_0_0: Swift.Sendable> from @escaping @isolated(any) @callee_guaranteed @async () -> (@out τ_0_0) to @escaping @callee_guaranteed @async () -> (@out τ_0_0, @error @owned Swift.Error) frame #5: 0x000000010224ae24 Testing`closure #1 in __checkClosureCall(throws:performing:expression:comments:isRequired:sourceLocation:) ``` Initially I thought swift testing doesn't support test discovery in linked dylibs but it's apparently not the case. And according to gemini it's not anything else in a binary but ``` Load command 9 cmd LC_BUILD_VERSION platform 7 - minos 14.0 + minos 15.6 sdk 26.4 ``` As it tried to use `15.6` in `swift_flags` and put `14.0` in `ldflags` and hit the same crash. This is what gemini has to say: > This is the definitive end of the road! 🔬 > > I have mathematically eliminated every other variable in computing existence. Between a binary that crashes and a binary that runs, literally NOTHING changed except that single number. Also it thinks it's because of this in `dyld`: > Look at the code in dyldMain.cpp at Line 430: > > cpp > // dyldMain.cpp Line 430 > // TODO: Remove once drop support for simulators older than iOS 17, tvOS 15, and watchOS 8 > mach_o::PlatformAndVersions pvs = dyldSimHdr->platformAndVersions(); > mach_o::Policy policy(mach_o::Architecture(), pvs, 0); > // [!!] THE SMOKING GUN [!!] > // Old simulators add the main executable to all_image_info in the simulator process, not in the host > if ( policy.enforceImageListRemoveMainExecutable() ) { > STACK_ALLOC_ARRAY(const mach_header*, mhs, 1); > mhs.push_back(state.config.process.mainExecutableMF); > std::span<const mach_header*> mhSpan(&mhs[0], 1); > > // LITERALLY REMOVES THE IMAGE FROM THE TRACKING TABLE!! > state.externallyViewable->removeImages(state.persistentAllocator, ephemeralAllocator, mhSpan); > } > Why this triggers your exact crash: > The Condition: policy.enforceImageListRemoveMainExecutable() explicitly returns true for all binaries linked below a specific epoch (iOS 15/16). > The Destructive Action: Because dyld thinks it needs to work around an ancient Simulator bug, it explicitly calls removeImages, ripping your binary's tracking data directly out of the global tracking table (all_image_info). > The Crash: Modern Swift Testing and the Swift Runtime rely on scanning all_image_info to discover where the @test sections are in memory! > The Final Blow: Because dyld just destructively hid the image from the tracking table, the Swift Runtime couldn't look it up, failed to resolve the internal metadata pointers, and instantly crashed in swift_getTypeByMangledName. > By simply lying and writing minos 15.0 into the header, you caused policy.enforceImageListRemoveMainExecutable() to return false, totally disabling this destructive legacy workaround and leaving your image intact for Swift to find! 🔬🏆🏁 ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
bkonyi
pushed a commit
that referenced
this pull request
May 20, 2026
…6792) https://skia.googlesource.com/skia.git/+log/19ad9707e5c6..d45969a5752e 2026-05-20 [email protected] Reland #3 "MiraclePtr: Add raw_ptr definitions" 2026-05-20 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/skia-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
bkonyi
pushed a commit
that referenced
this pull request
May 20, 2026
…6809) https://skia.googlesource.com/skia.git/+log/d45969a5752e..5f4f454b9662 2026-05-20 [email protected] Fix for integer wraparound in sksl 2026-05-20 [email protected] Revert "Reland #3 "MiraclePtr: Add raw_ptr definitions"" If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/skia-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
bkonyi
pushed a commit
that referenced
this pull request
May 21, 2026
…rent (e.g. Table) (flutter#185793) ## Issue Fixes flutter#174133 (and the duplicate flutter#180337). Placing a widget that hosts an `OverlayPortal` — most visibly `Slider`, but anything that calls `OverlayPortalController.show()` before its `OverlayPortal` is mounted — inside a `Table`/`TableRow` crashes during mount with: ``` 'package:flutter/src/rendering/object.dart': Failed assertion: line 2138 pos 12: 'child.owner == owner': is not true. #2 RenderObject.redepthChild #3 _RenderDeferredLayoutBox.redepthChildren overlay.dart:2576 #4 RenderObject.redepthChild #5 RenderObject.adoptChild #6 _RenderTheater._addDeferredChild overlay.dart:1312 flutter#7 _OverlayEntryLocation._addChild overlay.dart:2185 flutter#8 _OverlayPortalElement.insertRenderObjectChild overlay.dart:2447 ... flutter#24 _TableElement.mount.<anonymous closure>... table.dart:303 ``` This is a regression introduced between Flutter 3.32 and 3.35. ## Root cause `Table` defers calling `adoptChild` on its `RenderObject` children until *every* row has been mounted (`_TableElement.insertRenderObjectChild` is a no-op while `_doingMountOrUpdate`; the children are wired in later by `_updateRenderObjectChildren`). Meanwhile `_OverlayPortalElement.mount` runs `super.mount` (which "attaches" the layout surrogate to its parent — but Table swallows it) and then immediately mounts the overlay child, which causes the deferred-layout box to be adopted by the `_RenderTheater`. The theater is attached, so the deferred box receives an owner — *while the layout surrogate has none yet*. When the theater calls `redepthChild(deferredBox)`, the deferred box's `redepthChildren` unconditionally calls `_layoutSurrogate.redepthChild(this)`, which trips the `child.owner == owner` assertion across that owner boundary. ## Fix `_RenderDeferredLayoutBox.redepthChildren` now skips the cross-redepth when the surrogate is not yet attached, mirroring the existing guard in `_RenderLayoutSurrogateProxyBox.redepthChildren`: ```dart if (_layoutSurrogate.attached) { _layoutSurrogate.redepthChild(this); } ``` The depth invariant is restored when the surrogate is finally adopted by its parent: `_RenderLayoutSurrogateProxyBox.redepthChildren` already calls `redepthChild(_deferredLayoutChild)` once that child becomes attached. ## Tests Adds a regression test in `test/widgets/table_test.dart` placing an `OverlayPortal` whose controller is `.show()`'d before mount (mirroring `Slider`) inside a `TableRow`, asserting that no exception is thrown and the overlay child is present. Without this fix the new test reproduces the assertion. With this fix `flutter test test/widgets/table_test.dart`, `test/widgets/overlay_portal_test.dart`, `test/widgets/overlay_test.dart`, `test/widgets/raw_tooltip_test.dart`, `test/widgets/overlay_layout_builder_test.dart`, and `test/material/slider_test.dart` all pass. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making. - [x] All existing and new tests are passing. [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo --------- Co-authored-by: Victor Sanni <[email protected]>
bkonyi
pushed a commit
that referenced
this pull request
Jun 1, 2026
flutter#187370) …gine (flutter#187268)" Reason for revert: removal of some snapshot binaries break mac code signing Looks like the removal of the MCP server snapshot (and others) caused the codesigning failure. Log from the Dart SDK roll that was in the reverted patch: https://dart.googlesource.com/sdk.git/+log/6833224264116d1becc20dd037d6c25c92194612..3cdc25e8ffe98c61b36af485573639dc833b75cb Failure logs for arm64 and x64 bots both show the same errors: * https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_arm64%20verify_binaries_pre_codesigned/5308 * https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_x64%20verify_binaries_pre_codesigned/5305/overview Errors: ``` Expected binaries not found in cache: /Volumes/Work/s/w/ir/x/w/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot /Volumes/Work/s/w/ir/x/w/flutter/bin/cache/dart-sdk/bin/snapshots/dart_mcp_server_aot.dart.snapshot /Volumes/Work/s/w/ir/x/w/flutter/bin/cache/dart-sdk/bin/snapshots/dartdevc.dart.snapshot /Volumes/Work/s/w/ir/x/w/flutter/bin/cache/dart-sdk/bin/snapshots/kernel-service.dart.snapshot If this commit is removing binaries from the cache, this test should be fixed by removing the relevant entry from either the "binariesWithEntitlements" or "binariesWithoutEntitlements" getters in dev/tools/lib/codesign.dart. ╔═╡ERROR #1╞════════════════════════════════════════════════════════════════════ ║ UNEXPECTED ERROR! ║ Exception: Did not find all expected binaries! ║ #0 verifyExist (file:///Volumes/Work/s/w/ir/x/w/flutter/dev/bots/suite_runners/run_verify_binaries_codesigned_tests.dart:231:5) ║ <asynchronous suspension> ║ #1 verifyPreCodesignedTestRunner (file:///Volumes/Work/s/w/ir/x/w/flutter/dev/bots/suite_runners/run_verify_binaries_codesigned_tests.dart:40:3) ║ <asynchronous suspension> ║ #2 _runFromList (file:///Volumes/Work/s/w/ir/x/w/flutter/dev/bots/utils.dart:727:7) ║ <asynchronous suspension> ║ #3 main (file:///Volumes/Work/s/w/ir/x/w/flutter/dev/bots/test.dart:123:5) ║ <asynchronous suspension> ║ ║ The test.dart script should be corrected to catch this error and call foundError(). ║ Some tests are likely to have been skipped. ╚═══════════════════════════════════════════════════════════════════════════════ Step failed (retcode: 255) ``` This reverts commit 6d7a865. <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
bkonyi
pushed a commit
that referenced
this pull request
Jun 2, 2026
Fixes flutter#184725 This PR makes the tool exit when building with XCode and we didn't parse any build setting. I understand that there are no cases where this map can be empty, as it includes the app bundle ID, which is required when building. If we don't exit, it can show unrelated error messages to the users which could be confusing and hard to debug. For instance, from the linked issue, one could end up getting: `No valid code signing certificates were found` simply because the development team build setting was not available, despite having valid certificates installed. Sample output: ``` [ +63 ms] executing: [/Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj/] /usr/bin/arch -arm64e xcrun xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios [ ] executing: [/Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj/] /usr/bin/arch -arm64e xcrun xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios [ +765 ms] Command line invocation: /Applications/Xcode-26.3.0.app/Contents/Developer/usr/bin/xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios Build settings from command line: BUILD_DIR = /Users/admin/builds/AEFj1IwjB/0/repo/build/ios 2026-04-06 17:36:53.692 xcodebuild[9020:45597] Writing error result bundle to /var/folders/4p/084k9rr96ld_w60n8rdr0wtm0000gn/T/ResultBundle_2026-06-04_17-36-0053.xcresult xcodebuild: error: Could not configure request to show build settings: Unable to find a destination matching the provided destination specifier: { generic:1, platform:iOS } Ineligible destinations for the "Runner" scheme: { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 26.2 is not installed. Please download and install the platform from Xcode > Settings > Components. } [ ] Unexpected failure to get Xcode build settings: ProcessException: Process exited abnormally with exit code 64: Command line invocation: /Applications/Xcode-26.3.0.app/Contents/Developer/usr/bin/xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios Build settings from command line: BUILD_DIR = /Users/admin/builds/AEFj1IwjB/0/repo/build/ios 2026-04-06 17:36:53.692 xcodebuild[9020:45597] Writing error result bundle to /var/folders/4p/084k9rr96ld_w60n8rdr0wtm0000gn/T/ResultBundle_2026-06-04_17-36-0053.xcresult xcodebuild: error: Could not configure request to show build settings: Unable to find a destination matching the provided destination specifier: { generic:1, platform:iOS } Ineligible destinations for the "Runner" scheme: { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 26.2 is not installed. Please download and install the platform from Xcode > Settings > Components. } Command: /usr/bin/arch -arm64e xcrun xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios. [ +2 ms] Archiving example.com.myapp... [ +25 ms] Migrating AppFrameworkInfo.plist contents [ ] Upgrading AppFrameworkInfo.plist [ ] Upgrading Podfile [ +9 ms] The Swift Package Manager feature is off. Skipping the migration that adds Swift Package Manager integration... [ +6 ms] executing: xattr -r -d com.apple.FinderInfo /Users/admin/builds/AEFj1IwjB/0/repo [+1948 ms] Failed to remove xattr com.apple.FinderInfo from /Users/admin/builds/AEFj1IwjB/0/repo [ +1 ms] executing: [/Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj/] /usr/bin/arch -arm64e xcrun xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios [ ] executing: [/Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj/] /usr/bin/arch -arm64e xcrun xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios [ +920 ms] Command line invocation: /Applications/Xcode-26.3.0.app/Contents/Developer/usr/bin/xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios Build settings from command line: BUILD_DIR = /Users/admin/builds/AEFj1IwjB/0/repo/build/ios 2026-04-06 17:36:56.608 xcodebuild[9023:45646] Writing error result bundle to /var/folders/4p/084k9rr96ld_w60n8rdr0wtm0000gn/T/ResultBundle_2026-06-04_17-36-0056.xcresult xcodebuild: error: Could not configure request to show build settings: Unable to find a destination matching the provided destination specifier: { generic:1, platform:iOS } Ineligible destinations for the "Runner" scheme: { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 26.2 is not installed. Please download and install the platform from Xcode > Settings > Components. } [ ] Unexpected failure to get Xcode build settings: ProcessException: Process exited abnormally with exit code 64: Command line invocation: /Applications/Xcode-26.3.0.app/Contents/Developer/usr/bin/xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios Build settings from command line: BUILD_DIR = /Users/admin/builds/AEFj1IwjB/0/repo/build/ios 2026-04-06 17:36:56.608 xcodebuild[9023:45646] Writing error result bundle to /var/folders/4p/084k9rr96ld_w60n8rdr0wtm0000gn/T/ResultBundle_2026-06-04_17-36-0056.xcresult xcodebuild: error: Could not configure request to show build settings: Unable to find a destination matching the provided destination specifier: { generic:1, platform:iOS } Ineligible destinations for the "Runner" scheme: { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 26.2 is not installed. Please download and install the platform from Xcode > Settings > Components. } Command: /usr/bin/arch -arm64e xcrun xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/repo/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/repo/build/ios. [ +66 ms] executing: which security [ +4 ms] executing: which openssl [ +22 ms] executing: security find-identity -p codesigning -v [ +57 ms] 1) <ID> "Apple Distribution: ACME. (<ID>)" 1 valid identities found [ +1 ms] ════════════════════════════════════════════════════════════════════════════════ No valid code signing certificates were found You can connect to your Apple Developer account by signing in with your Apple ID in Xcode and create an iOS Development Certificate as well as a Provisioning Profile for your project by: 1- Open the Flutter project's Xcode target with open ios/Runner.xcworkspace 2- Select the 'Runner' project in the navigator then the 'Runner' target in the project settings 3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team. You may need to: - Log in with your Apple ID in Xcode first - Ensure you have a valid unique Bundle ID - Register your device with your Apple Developer Account - Let Xcode automatically provision a profile for your app 4- Build or run your project again 5- Trust your newly created Development Certificate on your iOS device via Settings > General > Device Management > [your new certificate] > Trust For more information, please visit: https://developer.apple.com/library/content/documentation/IDEs/Conceptual/ AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html Or run on an iOS simulator without code signing ════════════════════════════════════════════════════════════════════════════════ [ +1 ms] "flutter ipa" took 7,479ms. [ +2 ms] executing: sw_vers -productName [ +8 ms] Exit code 0 from: sw_vers -productName [ ] macOS [ ] executing: sw_vers -productVersion [ +6 ms] Exit code 0 from: sw_vers -productVersion [ ] 26.0 [ ] executing: sw_vers -buildVersion [ +6 ms] Exit code 0 from: sw_vers -buildVersion [ ] 25A354 [ ] executing: uname -m [ +10 ms] Exit code 0 from: uname -m [ ] arm64 [ +20 ms] No development certificates available to code sign app for device deployment [ ] #0 throwToolExit (package:flutter_tools/src/base/common.dart:34:3) #1 XcodeCodeSigningSettings._getCodeSigningBuildSettings (package:flutter_tools/src/ios/code_signing.dart:340:9) <asynchronous suspension> #2 buildXcodeProject (package:flutter_tools/src/ios/mac.dart:322:26) <asynchronous suspension> #3 _BuildIOSSubCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:986:37) <asynchronous suspension> #4 BuildIOSArchiveCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:477:50) <asynchronous suspension> #5 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1590:27) <asynchronous suspension> #6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19) <asynchronous suspension> flutter#7 CommandRunner.runCommand (package:args/command_runner.dart:212:13) <asynchronous suspension> flutter#8 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:496:9) <asynchronous suspension> flutter#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19) <asynchronous suspension> flutter#10 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:431:5) <asynchronous suspension> flutter#11 FlutterCommandRunner.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:307:33) <asynchronous suspension> flutter#12 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:104:11) <asynchronous suspension> flutter#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19) <asynchronous suspension> flutter#14 main (package:flutter_tools/executable.dart:103:3) <asynchronous suspension> [ ] Running 2 shutdown hooks [ ] Shutdown hooks complete [ +56 ms] exiting with code 1 ``` ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Elijah Okoroh <[email protected]>
bkonyi
pushed a commit
that referenced
this pull request
Aug 24, 2026
…dependencies through the new DSL (flutter#191218) This is PR 3 of 11 in the AGP 9.1.0 / public `gradle-api`/ newdsl migration stack. * It migrates many (but not all) usages of getLegacyAndroidExtension. * Introduces consistency in renaming of imports. * Adds a test to ensure we are not adding internal apis (thanks @mboetger from pr1) * builds the ability to run our gradle tests with multiple AGP versions (see packages/flutter_tools/gradle/build.gradle.kts) Between PR 3 and PR 8, an Add-to-app host app embedding a Flutter module with a custom build type (for example "staging") gets release engine artifacts. That means hot reload, debugger attach, and DevTools do not operate in that build. We can't move the work in PR 8 up but I would not want to cut a release between this pr and 8 landing. If we keep reviewing one pr a day then that is not a risk. Apps impacted by this change can use matchingFallbacks to avoid this problem (see code below). In pr 8 we change when we look for "isDebuggable" to much later in the gradle lifeycle when all the variants have been created which then lets us use a new api to understand if the variant is intended to be debuggable. Kotlin ```kotlin // host app build.gradle.kts android { buildTypes { create("staging") { isDebuggable = true applicationIdSuffix = ".staging" matchingFallbacks += "debug" /// This line. } } } ``` Groovy ```groovy // host app build.gradle android { buildTypes { staging { debuggable true applicationIdSuffix ".staging" matchingFallbacks = ['debug'] /// This line. } } } ``` Depends on flutter#190957 (PR 2). - @reidbaker --- Standard review context for this pr stack This is PR is part of an 11 pr stack to migrate the "newdsl" `gradle-api` specifically in agp 9.1.0. The complete stack has passed presubmits, postsubmits, and customer tests: https://flutter-dashboard.appspot.com/#/build?repo=flutter&branch=experimental/agp-gradle-api All of the code was LLM authored. A mix of manual prompting, automatic prompting, several models and adversarial review. The combined sessions are enough that I cannot include relevant prompts like I have been doing on other prs. If you want to review the pr stack you can find it here. These prs will be abandoned/closed as prs land into flutter/flutter. 1. reidbaker-agent#1 (branch: agp-api-doc) 2. reidbaker-agent#2 (branch: agp-internal-utils) 3. reidbaker-agent#3 (branch: agp-buildmode-deps) 4. reidbaker-agent#4 (branch: agp-plugin-buildtypes) 5. reidbaker-agent#5 (branch: agp-ndk-fallback) 6. reidbaker-agent#6 (branch: agp-assets-onvariants) 7. reidbaker-agent#7 (branch: agp-apk-copy-versioncode) 8. reidbaker-agent#8 (branch: agp-add-to-app) 9. reidbaker-agent#9 (branch: agp-aar-script) 10. reidbaker-agent#10 (branch: agp-newdsl-flip) 11. reidbaker-agent#11 (branch: agp-gradle-api) This work is urgent in the sense that we are worried that android will publish agp 10 with no opt out but not so urgent that we are willing to break flutter users because we didn't review or understand the code because we were in a rush. Breaking changes are expected as part of this work. There are patterns the android team explicitly does not want apps to use and apis that have no equivalent. As part of the effort to ensure this work does not slip into ai slop, prs from this stack will be reviewed by me (@reidbaker) before asking for review. Then we will have 2 android expert reviewers also review every pr. --- Agent authored description. This is PR 3 of 11 in the AGP 9.1.0 / public `gradle-api` migration stack (flutter#180137, flutter#166550). ### Key Changes - **DSL Build Mode Overloads**: Adds `buildModeFor` overloads accepting `ApplicationBuildType`, `DynamicFeatureBuildType`, and `LibraryBuildType` DSL types alongside the `(buildTypeName, isDebuggable)` core overload. - **Robust CompileSdkVersion Domain Model**: Extracts `CompileSdkVersion` with constructor invariant validation (`init { require(...) }`) enforcing mutual exclusivity between `apiLevel` and `previewCodename`. - **Namespaced Multi-AGP Build Property**: Namespaces the AGP version property in `packages/flutter_tools/gradle/build.gradle.kts` as `flutter.internal.agpVersion` (defaulting to `8.11.1`) to prevent user app properties from leaking into the included build during app compilation. - **Standardized Type Aliasing**: Applies non-temporal type aliasing (`import com.android.build.api.dsl.BuildType as DslBuildType`) across `FlutterPlugin.kt` and `PluginHandler.kt`. - **Public DSL Extension Access**: Updates `addFlutterDependencies` and `PluginHandler` to iterate `AgpCommonExtensionWrapper.buildTypes`. - **Build & Bytecode Validation**: Adds the `:validateNoCommonExtensionInBytecode` task in `build.gradle.kts` to prevent compiled main classes from referencing binary-incompatible `CommonExtension`, and adds `BytecodeValidatorTest.kt` verifying the binary pattern-matching and class scanning logic. - **Comprehensive Unit Tests**: Adds full 4-way dispatch test coverage in `AgpCommonExtensionWrapperTest`, dependency wiring tests in `FlutterPluginTest`, and decomposes `PluginHandlerTest` mock fixtures into focused helpers with positive assertions. ### Add-to-App & DSL Scope Context `LibraryBuildType` does not expose `isDebuggable` at DSL scope. In PR 3, custom build types on library projects (e.g. host app 'staging') fall back to `"release"` at DSL scope. In PR 8 ("Unify add-to-app module wiring on the variant API"), module wiring will be unified on `Component.debuggable` at variant scope. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. --------- Co-authored-by: reidbaker-agent <[email protected]> Co-authored-by: Reid Baker <[email protected]>
bkonyi
added a commit
that referenced
this pull request
Sep 4, 2026
…termination (flutter#192294) ## Description When a target application process exits prematurely (e.g. exit code 255) before the Debug Adapter Protocol (DAP) initialization handshake completes, `flutter_tools` crashed with an unhandled `DebugAdapterException` in the Dart Zone. In Flutter 3.47.2 telemetry, this was the #3 top crasher with 203 crashes (`DebugAdapterException-34d39b25`). ### Root Cause 1. `FlutterBaseDebugAdapter.handleSessionTerminate` completed `debuggerInitializationFailedCompleter.completeError(...)` before calling `super.handleSessionTerminate(...)`. 2. In `package:dap_adapters` (`DartDebugAdapter`), `handleSessionTerminate` is asynchronous and awaits pending output events before setting `isTerminating = true`. 3. In `FlutterDebugAdapter._handleAppStarted`, the unawaited asynchronous message handler caught the error while `isTerminating` was still `false`, rethrowing `DebugAdapterException` into the Zone. ### Fix 1. Synchronously set `isTerminating = true` in `FlutterBaseDebugAdapter.handleSessionTerminate`. 2. In `FlutterDebugAdapter._handleAppStarted`, catch `DebugAdapterException` and send the message to console output rather than rethrowing into the Zone. 3. Clean up early termination message formatting when `exitSuffix` is provided. ## Related Issues * Fixes crasher `DebugAdapterException-34d39b25` in Flutter 3.47.1 and 3.47.2 telemetry. ## Tests * Added regression tests in `packages/flutter_tools/test/general.shard/dap/flutter_adapter_test.dart` and `flutter_test_adapter_test.dart` verifying that early process exit outputs cleanly to console and does not produce unhandled asynchronous exceptions.
bkonyi
added a commit
that referenced
this pull request
Nov 6, 2026
…tures Only include the UTF-8 encoding remediation hint in `TestCommand.verifyThenRunCommand` when `readAsStringSync` fails due to a UTF-8 decoding error (`err.osError == null` and `readAsBytesSync` succeeds), rather than on OS or filesystem read failures. Add a hermetic regression test for OS `FileSystemException`s and document the AppleDouble and UTF-16 LE byte-array fixtures in `test_test.dart`. Previous output (AppleDouble sidecar files): ``` Failed to decode data using encoding 'utf-8', path = '/usr/local/google/home/bkonyi/.gemini/jetski/brain/ee6d5e68-1051-40e6-a23a-a289ca33c97a/scratch/repro_app/test/._a_test.dart' dart:io _File.readAsStringSync package:test_core/src/runner/loader.dart 41:22 Loader.parseSuiteMetadata.<fn>.<fn> package:async/src/result/result.dart 67:40 new Result package:test_core/src/runner/loader.dart 38:14 Loader.parseSuiteMetadata.<fn> dart:_compact_hash _LinkedHashMapMixin.putIfAbsent package:test_core/src/runner/loader.dart 36:35 Loader.parseSuiteMetadata package:test_core/src/runner/loader.dart 266:41 Loader.loadFile This is an unexpected error. Please file an issue at http://github.com/dart-lang/test with the stack trace and instructions for reproducing the error. FileSystemException: Failed to decode data using encoding 'utf-8', path = '/usr/local/google/home/bkonyi/.gemini/jetski/brain/ee6d5e68-1051-40e6-a23a-a289ca33c97a/scratch/repro_app/test/._widget_test.dart' #0 _File._tryDecode (dart:io/file_impl.dart:704:7) #1 _File.readAsStringSync (dart:io/file_impl.dart:715:7) #2 Loader.parseSuiteMetadata.<anonymous closure>.<anonymous closure> (package:test_core/src/runner/loader.dart:41:22) #3 new Result (package:async/src/result/result.dart:67:40) #4 Loader.parseSuiteMetadata.<anonymous closure> (package:test_core/src/runner/loader.dart:38:14) #5 _LinkedHashMapMixin.putIfAbsent (dart:_compact_hash:631:23) #6 Loader.parseSuiteMetadata (package:test_core/src/runner/loader.dart:36:35) flutter#7 Loader.loadFile (package:test_core/src/runner/loader.dart:266:41) <asynchronous suspension> Feature flags enabled: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-riscv64, enable-hcpp ``` Current output (AppleDouble sidecar files): ``` 00:00 +0: loading /usr/local/google/home/bkonyi/.gemini/jetski/brain/ee6d5e68-1051-40e6-a23a-a289ca33c97a/scratch/repro_app/test/widget_test.dart 00:00 +0: passes 00:00 +1: All tests passed! ``` Previous output (non-UTF-8 test files): ``` Failed to decode data using encoding 'utf-8', path = '/usr/local/google/home/bkonyi/.gemini/jetski/brain/ee6d5e68-1051-40e6-a23a-a289ca33c97a/scratch/repro_app/test/non_utf8_1_test.dart' dart:io _File.readAsStringSync package:test_core/src/runner/loader.dart 41:22 Loader.parseSuiteMetadata.<fn>.<fn> package:async/src/result/result.dart 67:40 new Result package:test_core/src/runner/loader.dart 38:14 Loader.parseSuiteMetadata.<fn> dart:_compact_hash _LinkedHashMapMixin.putIfAbsent package:test_core/src/runner/loader.dart 36:35 Loader.parseSuiteMetadata package:test_core/src/runner/loader.dart 266:41 Loader.loadFile This is an unexpected error. Please file an issue at http://github.com/dart-lang/test with the stack trace and instructions for reproducing the error. FileSystemException: Failed to decode data using encoding 'utf-8', path = '/usr/local/google/home/bkonyi/.gemini/jetski/brain/ee6d5e68-1051-40e6-a23a-a289ca33c97a/scratch/repro_app/test/non_utf8_2_test.dart' #0 _File._tryDecode (dart:io/file_impl.dart:704:7) #1 _File.readAsStringSync (dart:io/file_impl.dart:715:7) #2 Loader.parseSuiteMetadata.<anonymous closure>.<anonymous closure> (package:test_core/src/runner/loader.dart:41:22) #3 new Result (package:async/src/result/result.dart:67:40) #4 Loader.parseSuiteMetadata.<anonymous closure> (package:test_core/src/runner/loader.dart:38:14) #5 _LinkedHashMapMixin.putIfAbsent (dart:_compact_hash:631:23) #6 Loader.parseSuiteMetadata (package:test_core/src/runner/loader.dart:36:35) flutter#7 Loader.loadFile (package:test_core/src/runner/loader.dart:266:41) <asynchronous suspension> Feature flags enabled: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-riscv64, enable-hcpp ``` Current output (non-UTF-8 test files): ``` Failed to read test file "/usr/local/google/home/bkonyi/.gemini/jetski/brain/ee6d5e68-1051-40e6-a23a-a289 ca33c97a/scratch/repro_app/test/non_utf8_1_test.dart": Failed to decode data using encoding 'utf-8'. Ensure that the file is a valid UTF-8 encoded Dart test file. ```
bkonyi
added a commit
that referenced
this pull request
Nov 9, 2026
… overwrite test Updates `native_assets_flutter_test_manifest_overwrite_test.dart` to invoke `flutterBin` (`test_utils.dart`) with `@Timeout(Duration(minutes: 5))` instead of manually compiling `bin/flutter_tools.dart` to `flutter_tools.dill`, and uses `loadPackageConfig`, `PackageConfig`, `Package`, `LanguageVersion`, and `savePackageConfig` from `package:package_config/package_config.dart` to construct the offline test project's `.dart_tool/package_config.json`. Previous output: ``` Unhandled exception: FileSystemException: Cannot rename file to '/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp', path = '/tmp/repro_196121_src.tmp' (OS Error: Invalid cross-device link, errno = 18) #0 _File.throwIfError (dart:io/file_impl.dart:779:7) #1 _File.renameSync (dart:io/file_impl.dart:396:5) #2 ForwardingFileSystemEntity.renameSync (package:file/src/forwarding/forwarding_file_system_entity.dart:50:49) #3 ErrorHandlingFile.renameSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:430:31) #4 _runSync (package:flutter_tools/src/base/error_handling_io.dart:1116:16) #5 ErrorHandlingFile.renameSync (package:flutter_tools/src/base/error_handling_io.dart:429:12) #6 main (file:///usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_exdev.dart:24:37) flutter#7 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:313:19) flutter#8 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12) ``` Current output: ``` Flutter failed to rename file at "/tmp/repro_196121_src.tmp" to "/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp". A file system operation failed across different volumes or mount points. FileSystemException: Cannot rename file to '/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp', path = '/tmp/repro_196121_src.tmp' (OS Error: Invalid cross-device link, errno = 18) Ensure that the project, build output, and temporary directories are on the same writable volume, or check external volume and security software settings. ``` Previous output (flutter test overwriting existing native_assets.json): ``` Flutter failed to delete file at "/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4 d2ca98a9/scratch/repro_app/build/native_assets/linux/native_assets.json". Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user. Try running: sudo chown -R $(whoami) /usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc 4d2ca98a9/scratch/repro_app/build/native_assets/linux/native_assets.json ``` Current output (flutter test overwriting existing native_assets.json): ``` 00:00 +0: loading /usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_app/test/smoke_test.dart 00:00 +0: smoke test 00:00 +1: All tests passed! ``` Fixes flutter#196121
bkonyi
added a commit
that referenced
this pull request
Nov 9, 2026
Simplifies the fix and tests for avoiding redundant `native_assets.json` deletion and handling `EXDEV`: - Restores `ErrorHandlingFileSystem.deleteIfExists` to upstream and removes custom `ForwardingFileSystem` test doubles in `error_handling_io_test.dart`, testing `EXDEV` (`errno = 18`) directly with `MemoryFileSystem.test(opHandle: exceptionHandler.opHandle)`. - Streams `targetDir.list(followLinks: false)` in `_copyNativeCodeAssetsForOS` with `entity is File` instead of `.toList()` and `typeSync`, and deduplicates `installCodeAssets` test setup in `native_assets_test.dart`. - Removes the redundant `flutter test` subprocess integration test (`native_assets_flutter_test_manifest_overwrite_test.dart`). Reproduction notes: Both output pairs below were captured on a Linux host, which cannot reproduce the macOS external-volume behavior directly. The first pair comes from a small Dart script (`repro_exdev.dart`) calling `ErrorHandlingFileSystem.file(...).renameSync(...)` from `/tmp` (`tmpfs`) to an `ext4` directory to trigger a real kernel `EXDEV` (`errno = 18`). The second pair comes from running `BOT=true flutter test --no-pub -r expanded` on a minimal app after making `build/native_assets/linux` read-only (`chmod 0555`) while leaving `native_assets.json` writable (`0644`), so `unlink(2)` fails while in-place truncation succeeds; with a writable `build/native_assets/linux` directory, the unfixed tool passes with the same 3-line test output. Local workspace paths inside the fenced output blocks are preserved verbatim to match exact command output. Previous output: ``` Unhandled exception: FileSystemException: Cannot rename file to '/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp', path = '/tmp/repro_196121_src.tmp' (OS Error: Invalid cross-device link, errno = 18) #0 _File.throwIfError (dart:io/file_impl.dart:779:7) #1 _File.renameSync (dart:io/file_impl.dart:396:5) #2 ForwardingFileSystemEntity.renameSync (package:file/src/forwarding/forwarding_file_system_entity.dart:50:49) #3 ErrorHandlingFile.renameSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:430:31) #4 _runSync (package:flutter_tools/src/base/error_handling_io.dart:1116:16) #5 ErrorHandlingFile.renameSync (package:flutter_tools/src/base/error_handling_io.dart:429:12) #6 main (file:///usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_exdev.dart:24:37) flutter#7 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:313:19) flutter#8 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12) ``` Current output: ``` Flutter failed to rename file at "/tmp/repro_196121_src.tmp" to "/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp". A file system operation failed across different volumes or mount points. FileSystemException: Cannot rename file to '/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp', path = '/tmp/repro_196121_src.tmp' (OS Error: Invalid cross-device link, errno = 18) Ensure that the project, build output, and temporary directories are on the same writable volume, or check external volume and security software settings. ``` Previous output (flutter test overwriting existing native_assets.json): ``` Flutter failed to delete file at "/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4 d2ca98a9/scratch/repro_app/build/native_assets/linux/native_assets.json". Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user. Try running: sudo chown -R $(whoami) /usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc 4d2ca98a9/scratch/repro_app/build/native_assets/linux/native_assets.json ``` Current output (flutter test overwriting existing native_assets.json): ``` 00:00 +0: loading /usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_app/test/smoke_test.dart 00:00 +0: smoke test 00:00 +1: All tests passed! ``` Fixes flutter#196121
bkonyi
added a commit
that referenced
this pull request
Nov 9, 2026
…ative assets Restores `.toList()` on `targetDir.list(followLinks: false)` in `_copyNativeCodeAssetsForOS` so directory enumeration completes before deleting stale entries in `targetDir`, avoiding concurrent directory stream mutation issues on Windows and network filesystems. Reproduction notes: Both output pairs below were captured on a Linux host, which cannot reproduce the macOS external-volume behavior directly. The first pair comes from a small Dart script (`repro_exdev.dart`) calling `ErrorHandlingFileSystem.file(...).renameSync(...)` from `/tmp` (`tmpfs`) to an `ext4` directory to trigger a real kernel `EXDEV` (`errno = 18`). The second pair comes from running `BOT=true flutter test --no-pub -r expanded` on a minimal app after making `build/native_assets/linux` read-only (`chmod 0555`) while leaving `native_assets.json` writable (`0644`), so `unlink(2)` fails while in-place truncation succeeds; with a writable `build/native_assets/linux` directory, the unfixed tool passes with the same 3-line test output. Local workspace paths inside the fenced output blocks are preserved verbatim to match exact command output. Previous output: ``` Unhandled exception: FileSystemException: Cannot rename file to '/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp', path = '/tmp/repro_196121_src.tmp' (OS Error: Invalid cross-device link, errno = 18) #0 _File.throwIfError (dart:io/file_impl.dart:779:7) #1 _File.renameSync (dart:io/file_impl.dart:396:5) #2 ForwardingFileSystemEntity.renameSync (package:file/src/forwarding/forwarding_file_system_entity.dart:50:49) #3 ErrorHandlingFile.renameSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:430:31) #4 _runSync (package:flutter_tools/src/base/error_handling_io.dart:1116:16) #5 ErrorHandlingFile.renameSync (package:flutter_tools/src/base/error_handling_io.dart:429:12) #6 main (file:///usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_exdev.dart:24:37) flutter#7 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:313:19) flutter#8 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12) ``` Current output: ``` Flutter failed to rename file at "/tmp/repro_196121_src.tmp" to "/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp". A file system operation failed across different volumes or mount points. FileSystemException: Cannot rename file to '/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp', path = '/tmp/repro_196121_src.tmp' (OS Error: Invalid cross-device link, errno = 18) Ensure that the project, build output, and temporary directories are on the same writable volume, or check external volume and security software settings. ``` Previous output (flutter test overwriting existing native_assets.json): ``` Flutter failed to delete file at "/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4 d2ca98a9/scratch/repro_app/build/native_assets/linux/native_assets.json". Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user. Try running: sudo chown -R $(whoami) /usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc 4d2ca98a9/scratch/repro_app/build/native_assets/linux/native_assets.json ``` Current output (flutter test overwriting existing native_assets.json): ``` 00:00 +0: loading /usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_app/test/smoke_test.dart 00:00 +0: smoke test 00:00 +1: All tests passed! ``` Fixes flutter#196121
bkonyi
added a commit
that referenced
this pull request
Nov 11, 2026
…lutter#196134) Previously, `installCodeAssets` invoked `_copyNativeCodeAssetsForOS` on every `flutter test` run, which listed `build/native_assets/<os>/` and deleted `native_assets.json` right before `_writeNativeAssetsJson` truncated and overwrote that same file in place. On macOS external volumes (for example `/Volumes/...` where endpoint-security or recycle-bin interposers intercept `unlink(2)` and attempt a cross-volume `rename(2)`), unlinking `native_assets.json` failed with `FileSystemException (OS Error: Cross-device link, errno = 18)` (`EXDEV`). In addition, `_handlePosixException` did not map `EXDEV` (`errno = 18`) to a `ToolExit`. This change: 1. Skips deleting `native_assets.json` in `_copyNativeCodeAssetsForOS` when it already exists on disk as a regular file, since `_writeNativeAssetsJson` immediately truncates and overwrites it in place (while still deleting stale bundled native asset artifacts, directories, and symlinks). 2. Handles POSIX `EXDEV` (`errno = 18`) in `_handlePosixException` on Linux and macOS by throwing an actionable `ToolExit` instead of crashing with an unhandled `FileSystemException`. Reproduction notes: Both output pairs below were captured on a Linux host, which cannot reproduce the macOS external-volume behavior directly. The first pair comes from a small Dart script (`repro_exdev.dart`) calling `ErrorHandlingFileSystem.file(...).renameSync(...)` from `/tmp` (`tmpfs`) to an `ext4` directory to trigger a real kernel `EXDEV` (`errno = 18`). The second pair comes from running `BOT=true flutter test --no-pub -r expanded` on a minimal app after making `build/native_assets/linux` read-only (`chmod 0555`) while leaving `native_assets.json` writable (`0644`), so `unlink(2)` fails while in-place truncation succeeds; with a writable `build/native_assets/linux` directory, the unfixed tool passes with the same 3-line test output. Local workspace paths inside the fenced output blocks are preserved verbatim to match exact command output. Previous output: ``` Unhandled exception: FileSystemException: Cannot rename file to '/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp', path = '/tmp/repro_196121_src.tmp' (OS Error: Invalid cross-device link, errno = 18) #0 _File.throwIfError (dart:io/file_impl.dart:779:7) #1 _File.renameSync (dart:io/file_impl.dart:396:5) #2 ForwardingFileSystemEntity.renameSync (package:file/src/forwarding/forwarding_file_system_entity.dart:50:49) #3 ErrorHandlingFile.renameSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:430:31) #4 _runSync (package:flutter_tools/src/base/error_handling_io.dart:1116:16) #5 ErrorHandlingFile.renameSync (package:flutter_tools/src/base/error_handling_io.dart:429:12) #6 main (file:///usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_exdev.dart:24:37) flutter#7 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:313:19) flutter#8 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12) ``` Current output: ``` Flutter failed to rename file at "/tmp/repro_196121_src.tmp" to "/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp". A file system operation failed across different volumes or mount points. FileSystemException: Cannot rename file to '/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_196121_dst.tmp', path = '/tmp/repro_196121_src.tmp' (OS Error: Invalid cross-device link, errno = 18) Ensure that the project, build output, and temporary directories are on the same writable volume, or check external volume and security software settings. ``` Previous output (flutter test overwriting existing native_assets.json): ``` Flutter failed to delete file at "/usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4 d2ca98a9/scratch/repro_app/build/native_assets/linux/native_assets.json". Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user. Try running: sudo chown -R $(whoami) /usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc 4d2ca98a9/scratch/repro_app/build/native_assets/linux/native_assets.json ``` Current output (flutter test overwriting existing native_assets.json): ``` 00:00 +0: loading /usr/local/google/home/bkonyi/.gemini/jetski/brain/0a669702-1e2d-46a6-9c37-fdc4d2ca98a9/scratch/repro_app/test/smoke_test.dart 00:00 +0: smoke test 00:00 +1: All tests passed! ``` Fixes flutter#196121
bkonyi
added a commit
that referenced
this pull request
Nov 12, 2026
flutter#196136) Previously, `ErrorHandlingFile.readAsStringSync` dropped its `encoding` parameter when calling `delegate.readAsStringSync()`, forcing UTF-8 decoding even when callers requested another encoding (unlike `readAsString`, `readAsLines`, and `readAsLinesSync`, which already forwarded `encoding`). Because `flutter_tools` wraps `LocalFileSystem` in `ErrorHandlingFileSystem`, callers such as `ScreenshotCommand.ensureOutputIsNotJsonRpcError` (which passes `AsciiCodec(allowInvalid: true)` when checking small screenshot files for JSON-RPC error payloads) crashed with a `FileSystemException`. Forward `encoding` to `delegate.readAsStringSync(encoding: encoding)` and add regression tests covering `ErrorHandlingFile.readAsStringSync` backed by `LocalFileSystem` and `ScreenshotCommand.ensureOutputIsNotJsonRpcError` on `ErrorHandlingFileSystem`. Fixes flutter#196225 Previous output: ``` Screenshot written to flutter_01.skp (0kB). FileSystemException: Failed to decode data using encoding 'utf-8', path = '/tmp/repro_screenshot_skp.QPQNLT/flutter_01.skp' #0 _File._tryDecode (dart:io/file_impl.dart:704:7) #1 _File.readAsStringSync (dart:io/file_impl.dart:715:7) #2 ForwardingFile.readAsStringSync (package:file/src/forwarding/forwarding_file.dart:99:16) #3 ErrorHandlingFile.readAsStringSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:258:22) #4 _runSync (package:flutter_tools/src/base/error_handling_io.dart:1116:16) #5 ErrorHandlingFile.readAsStringSync (package:flutter_tools/src/base/error_handling_io.dart:257:12) #6 ScreenshotCommand.ensureOutputIsNotJsonRpcError (package:flutter_tools/src/commands/screenshot.dart:198:39) flutter#7 ScreenshotCommand.runSkia (package:flutter_tools/src/commands/screenshot.dart:180:5) <asynchronous suspension> flutter#8 ScreenshotCommand.runCommand (package:flutter_tools/src/commands/screenshot.dart:123:19) <asynchronous suspension> flutter#9 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:876:27) <asynchronous suspension> flutter#10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#11 CommandRunner.runCommand (package:args/command_runner.dart:212:13) <asynchronous suspension> flutter#12 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:689:9) <asynchronous suspension> flutter#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#14 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:619:5) <asynchronous suspension> flutter#15 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:379:5) <asynchronous suspension> flutter#16 run.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:419:19) <asynchronous suspension> flutter#17 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#18 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#19 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#20 main (package:flutter_tools/executable.dart:133:3) <asynchronous suspension> Feature flags enabled: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-riscv64, enable-hcpp ``` Current output: ``` Screenshot written to flutter_01.skp (0kB). ```
bkonyi
added a commit
that referenced
this pull request
Nov 12, 2026
Update `screenshot_test.dart` to write its synthetic package configuration via `writePackageConfigFiles`, resolve local engine paths via `LocalEngineLocator` and `getLocalEngineArguments()` with a normalized absolute `flutterBin` path, and register `flutter_tester` teardown immediately after process startup with early-exit reporting. Previous output: ``` _flutter.screenshotSkp: (-32000) Cannot capture SKP screenshot with Impeller enabled. #0 new _OutstandingRequest (package:vm_service/src/vm_service.dart:280:34) #1 VmService._call.<anonymous closure> (package:vm_service/src/vm_service.dart:1962:25) #2 VmService._call (package:vm_service/src/vm_service.dart:1974:8) #3 VmService.callServiceExtension (package:vm_service/src/vm_service.dart:1905:14) #4 FlutterVmService._checkedCallServiceExtension (package:flutter_tools/src/vmservice.dart:835:28) #5 FlutterVmService.screenshotSkp (package:flutter_tools/src/vmservice.dart:1069:12) #6 ScreenshotCommand.runSkia (package:flutter_tools/src/commands/screenshot.dart:167:54) <asynchronous suspension> flutter#7 ScreenshotCommand.runCommand (package:flutter_tools/src/commands/screenshot.dart:123:19) <asynchronous suspension> flutter#8 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:876:27) <asynchronous suspension> flutter#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#10 CommandRunner.runCommand (package:args/command_runner.dart:212:13) <asynchronous suspension> flutter#11 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:689:9) <asynchronous suspension> flutter#12 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#13 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:619:5) <asynchronous suspension> flutter#14 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:379:5) <asynchronous suspension> flutter#15 run.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:419:19) <asynchronous suspension> flutter#16 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#17 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#18 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#19 main (package:flutter_tools/executable.dart:133:3) <asynchronous suspension> Feature flags enabled: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-riscv64, enable-hcpp ``` Current output: ``` The Skia picture request failed: Cannot capture SKP screenshot with Impeller enabled. ``` Fixes flutter#196119
bkonyi
added a commit
that referenced
this pull request
Nov 13, 2026
…#196132) Previously, running `flutter screenshot --type=skia` against an application with Impeller enabled crashed with an unhandled `vm_service.RPCError` (`-32000`) because the engine rejects `_flutter.screenshotSkp` requests under Impeller and `ScreenshotCommand.runSkia` did not catch `RPCError`. Catch `vm_service.RPCError` in `ScreenshotCommand.runSkia` and exit cleanly via `throwToolExit` with the engine's error message. Previous output: ``` _flutter.screenshotSkp: (-32000) Cannot capture SKP screenshot with Impeller enabled. #0 new _OutstandingRequest (package:vm_service/src/vm_service.dart:280:34) #1 VmService._call.<anonymous closure> (package:vm_service/src/vm_service.dart:1962:25) #2 VmService._call (package:vm_service/src/vm_service.dart:1974:8) #3 VmService.callServiceExtension (package:vm_service/src/vm_service.dart:1905:14) #4 FlutterVmService._checkedCallServiceExtension (package:flutter_tools/src/vmservice.dart:835:28) #5 FlutterVmService.screenshotSkp (package:flutter_tools/src/vmservice.dart:1069:12) #6 ScreenshotCommand.runSkia (package:flutter_tools/src/commands/screenshot.dart:167:54) <asynchronous suspension> flutter#7 ScreenshotCommand.runCommand (package:flutter_tools/src/commands/screenshot.dart:123:19) <asynchronous suspension> flutter#8 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:876:27) <asynchronous suspension> flutter#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#10 CommandRunner.runCommand (package:args/command_runner.dart:212:13) <asynchronous suspension> flutter#11 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:689:9) <asynchronous suspension> flutter#12 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#13 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:619:5) <asynchronous suspension> flutter#14 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:379:5) <asynchronous suspension> flutter#15 run.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:419:19) <asynchronous suspension> flutter#16 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#17 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#18 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:174:19) <asynchronous suspension> flutter#19 main (package:flutter_tools/executable.dart:133:3) <asynchronous suspension> Feature flags enabled: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-riscv64, enable-hcpp ``` Current output: ``` The Skia picture request failed: Cannot capture SKP screenshot with Impeller enabled. ``` Fixes flutter#196119
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.
This is an automated pull request which will automatically merge once checks pass.