Repository: flutter
Issue: If debugDumpRenderTree crashes during a "t" tree dump, so does the flutter tool
Labels: tool,P3,team-tool,triaged-tool

I did something to the framework that made the debugDumpRenderTree function throw. This means the RPC did not return successfully when I hit "t" in `flutter run`. The result was that the tool itself crashed, with the following stack (I was running in `--verbose` mode):

```
Unhandled exception:
JSON-RPC error -32000: Server error
package:json_rpc_2/src/client.dart 109              Client.sendRequest
package:json_rpc_2/src/peer.dart 68                 Peer.sendRequest
package:flutter_tools/src/vmservice.dart 129        VMService._sendRequest
package:flutter_tools/src/vmservice.dart 648        VM.invokeRpcRaw
===== asynchronous gap ===========================
package:flutter_tools/src/vmservice.dart 886        Isolate.invokeRpcRaw
package:flutter_tools/src/vmservice.dart 966        Isolate.invokeFlutterExtensionRpcRaw
===== asynchronous gap ===========================
package:flutter_tools/src/vmservice.dart 982        Isolate.flutterDebugDumpRenderTree
package:flutter_tools/src/resident_runner.dart 132  ResidentRunner._debugDumpRenderTree
===== asynchronous gap ===========================
package:flutter_tools/src/resident_runner.dart 295  ResidentRunner._commonTerminalInputHandler
===== asynchronous gap ===========================
package:flutter_tools/src/resident_runner.dart 333  ResidentRunner.processTerminalInput
===== asynchronous gap ===========================
dart:async/zone.dart 1128                           _rootRunUnary
dart:async/zone.dart 1012                           _CustomZone.runUnary
dart:async/zone.dart 909                            _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 330                     _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 257                     _BufferingStreamSubscription._add
dart:async/stream_transformers.dart 68              _SinkTransformerStreamSubscription._add
dart:async/stream_transformers.dart 15              _EventSinkWrapper.add
dart:convert/string_conversion.dart 268             _StringAdapterSink.add
dart:convert/ascii.dart 298                         _SimpleAsciiDecoderSink.add
dart:convert/chunked_conversion.dart 96             _ConverterStreamEventSink.add
dart:async/stream_transformers.dart 120             _SinkTransformerStreamSubscription._handleData
dart:async/zone.dart 1128                           _rootRunUnary
dart:async/zone.dart 1012                           _CustomZone.runUnary
dart:async/zone.dart 909                            _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 330                     _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 257                     _BufferingStreamSubscription._add
dart:async/stream_controller.dart 757               _StreamController&&_SyncStreamControllerDispatch._sendData
dart:async/stream_controller.dart 628               _StreamController._add
dart:async/stream_controller.dart 574               _StreamController.add
dart:io-patch/socket_patch.dart 1617                _Socket._onData
dart:async/zone.dart 1132                           _rootRunUnary
dart:async/zone.dart 1012                           _CustomZone.runUnary
dart:async/zone.dart 909                            _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 330                     _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 257                     _BufferingStreamSubscription._add
dart:async/stream_controller.dart 757               _StreamController&&_SyncStreamControllerDispatch._sendData
dart:async/stream_controller.dart 628               _StreamController._add
dart:async/stream_controller.dart 574               _StreamController.add
dart:io-patch/socket_patch.dart 1203                _RawSocket._RawSocket.<fn>
dart:io-patch/socket_patch.dart 760                 _NativeSocket.issueReadEvent.issue
dart:async/schedule_microtask.dart 41               _microtaskLoop
dart:async/schedule_microtask.dart 50               _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 99            _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 152           _RawReceivePortImpl._handleMessage
../../runtime/vm/dart_api_impl.cc: 1871: error: Dart_GetMainPortId expects there to be a current isolate. Did you forget to call Dart_CreateIsolate or Dart_EnterIsolate?
/usr/local/google/home/ianh/dev/flutter/bin/flutter: line 91: 31996 Aborted                 (core dumped) "$DART" $FLUTTER_TOOL_ARGS "$SNAPSHOT_PATH" "$@"
```

cc @johnmccutchan