Fix hot restart flake (#122776)
This commit is contained in:
@@ -1019,7 +1019,10 @@ class FlutterVmService {
|
||||
onError: (Object? error, StackTrace stackTrace) {
|
||||
if (error is vm_service.SentinelException ||
|
||||
error == null ||
|
||||
(error is vm_service.RPCError && error.code == RPCErrorCodes.kServiceDisappeared)) {
|
||||
error is vm_service.RPCError &&
|
||||
(error.code == RPCErrorCodes.kServiceDisappeared ||
|
||||
error.code == RPCErrorCodes.kInternalError &&
|
||||
error.message.contains('Sentinel kind: Collected'))) {
|
||||
return null;
|
||||
}
|
||||
return Future<vm_service.Isolate?>.error(error, stackTrace);
|
||||
|
||||
@@ -45,6 +45,20 @@ Future<void> _testProject(HotReloadProject project, {String name = 'Default'}) a
|
||||
await flutter.hotRestart();
|
||||
});
|
||||
|
||||
testWithoutContext('$testName: hot restart works without error after delay', () async {
|
||||
flutter.stdout.listen(printOnFailure);
|
||||
await flutter.run(chrome: true, additionalCommandArgs: <String>['--verbose', '--web-renderer=html']);
|
||||
await Future<void>.delayed(const Duration(milliseconds: 200));
|
||||
await flutter.hotRestart();
|
||||
});
|
||||
|
||||
testWithoutContext('$testName: multiple hot restarts work without error', () async {
|
||||
flutter.stdout.listen(printOnFailure);
|
||||
await flutter.run(chrome: true, additionalCommandArgs: <String>['--verbose', '--web-renderer=html']);
|
||||
await Future<void>.delayed(const Duration(milliseconds: 200));
|
||||
await Future.wait(<Future<void>>[ flutter.hotRestart(), flutter.hotRestart()]);
|
||||
});
|
||||
|
||||
testWithoutContext('$testName: newly added code executes during hot restart', () async {
|
||||
final Completer<void> completer = Completer<void>();
|
||||
final StreamSubscription<String> subscription = flutter.stdout.listen((String line) {
|
||||
|
||||
Reference in New Issue
Block a user