Repository: flutter
Issue: _describeRelevantUserCode crash
Labels: c: regression,c: crash,framework,f: inspector,P2,team-framework,triaged-framework

```dart
  testWidgets('Does Text', (WidgetTester tester) async {
    await tester.pumpWidget(const Text('tight'));
    await tester.pumpWidget(const SizedBox(child: Text('loose')));
  });
```

I expected three exceptions, one from each pump, plus a third saying that I hadn't caught the first exception (you're supposed to call takeException after pump if pump throws).

However, one of those exceptions triggered a cascade of other exceptions because of some problem in _describeRelevantUserCode:

```
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown attaching to the render tree:
Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by
calling inheritFromWidgetOfExactType() in the widget's didChangeDependencies() method.

When the exception was thrown, this was the stack:
#0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure> (package:flutter/src/widgets/framework.dart:3423:9)
#1      Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:3437:6)
#2      Element.visitAncestorElements (package:flutter/src/widgets/framework.dart:3524:12)
#3      _describeRelevantUserCode (package:flutter/src/widgets/widget_inspector.dart:2827:13)
#4      _parseDiagnosticsNode (package:flutter/src/widgets/widget_inspector.dart:2794:10)
#5      transformDebugCreator (package:flutter/src/widgets/widget_inspector.dart:2774:14)
#6      _SyncIterator.moveNext (dart:core-patch/core_patch.dart:144:12)
#7      new List.from (dart:core-patch/array_patch.dart:45:19)
#8      Iterable.toList (dart:core/iterable.dart:398:5)
#9      _FlutterErrorDetailsNode.builder (package:flutter/src/foundation/assertions.dart:840:66)
#10     DiagnosticableNode.getProperties (package:flutter/src/foundation/diagnostics.dart:2914:87)
#11     TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1225:63)
#12     FlutterError.dumpErrorToConsole (package:flutter/src/foundation/assertions.dart:647:11)
#13     TestWidgetsFlutterBinding._runTest.<anonymous closure> (package:flutter_test/src/binding.dart:577:24)
#14     FlutterError.reportError (package:flutter/src/foundation/assertions.dart:736:14)
#15     _debugReportException (package:flutter/src/widgets/framework.dart:5314:16)
#16     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3982:9)
#17     Element.rebuild (package:flutter/src/widgets/framework.dart:3755:5)
#18     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3941:5)
#19     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3936:5)
#20     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3109:14)
#21     Element.updateChild (package:flutter/src/widgets/framework.dart:2903:12)
#22     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5165:14)
#23     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3109:14)
#24     Element.updateChild (package:flutter/src/widgets/framework.dart:2903:12)
#25     RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1028:16)
#26     RenderObjectToWidgetElement.update (package:flutter/src/widgets/binding.dart:1006:5)
#27     RenderObjectToWidgetElement.performRebuild (package:flutter/src/widgets/binding.dart:1020:7)
#28     Element.rebuild (package:flutter/src/widgets/framework.dart:3755:5)
#29     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2347:33)
#30     AutomatedTestWidgetsFlutterBinding.drawFrame (package:flutter_test/src/binding.dart:975:18)
#31     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:283:5)
#32     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1097:15)
#33     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1036:9)
#34     AutomatedTestWidgetsFlutterBinding.pump.<anonymous closure> (package:flutter_test/src/binding.dart:873:9)
#37     TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:69:41)
#38     AutomatedTestWidgetsFlutterBinding.pump (package:flutter_test/src/binding.dart:860:27)
#39     WidgetTester.pumpWidget.<anonymous closure> (package:flutter_test/src/widget_tester.dart:320:22)
#42     TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:69:41)
#43     WidgetTester.pumpWidget (package:flutter_test/src/widget_tester.dart:317:27)
#44     main.<anonymous closure> (/usr/local/google/home/ianh/dev/flutter/packages/flutter/test/rendering/repaint_boundary_2_test.dart:12:18)
<asynchronous suspension>
#45     testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:121:25)
<asynchronous suspension>
#46     TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:695:19)
<asynchronous suspension>
#49     TestWidgetsFlutterBinding._runTest (package:flutter_test/src/binding.dart:678:14)
#50     AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:1051:24)
#56     AutomatedTestWidgetsFlutterBinding.runTest (package:flutter_test/src/binding.dart:1048:15)
#57     testWidgets.<anonymous closure> (package:flutter_test/src/widget_tester.dart:118:22)
#58     Declarer.test.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:168:27)
<asynchronous suspension>
#59     Invoker.waitForOutstandingCallbacks.<anonymous closure> (package:test_api/src/backend/invoker.dart:250:15)
<asynchronous suspension>
#64     Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:247:5)
#65     Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:166:33)
#70     Declarer.test.<anonymous closure> (package:test_api/src/backend/declarer.dart:165:13)
<asynchronous suspension>
#71     Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:400:25)
<asynchronous suspension>
#85     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#86     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#87     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
(elided 32 frames from class _FakeAsync, package dart:async, package dart:async-patch, and package stack_trace)
════════════════════════════════════════════════════════════════════════════════════════════════════
...
```

cc @chunhtai @goderbauer @jacob314