Skip to content

API example smoke test failing silently #144353

@Piinks

Description

@Piinks

Noticed in a build log:
https://ci.chromium.org/ui/p/flutter/builders/try/Windows%20framework_tests_misc/56887/overview

00:07 +80: Smoke test material/color_scheme/color_scheme.0.dart
00:08 +81: Smoke test material/color_scheme/dynamic_content_color.0.dart
00:08 +82: Smoke test material/context_menu/context_menu_controller.0.dart
00:08 +82: Smoke test material/color_scheme/dynamic_content_color.0.dart
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test (but after the test had completed):
setState() called after dispose(): _DynamicColorExampleState#0cf43(lifecycle state: defunct, not
mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in
the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose()
callback. Another solution is to check the "mounted" property of this object before calling
setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is
retaining a reference to this State object after it has been removed from the tree. To avoid memory
leaks, consider breaking the reference to this object during dispose().

When the exception was thrown, this was the stack:
#0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1167:9)
#1      State.setState (package:flutter/src/widgets/framework.dart:1202:6)
#2      _DynamicColorExampleState._updateImage (package:flutter_api_samples/material/color_scheme/dynamic_content_color.0.dart:191:5)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:08 +83: Smoke test material/context_menu/editable_text_toolbar_builder.0.dart
00:08 +84: Smoke test material/context_menu/editable_text_toolbar_builder.1.dart

But this did not cause the test shard to fail. Should the build have failed here? (also we should fix the test)

Metadata

Metadata

Assignees

Labels

a: tests"flutter test", flutter_test, or one of our testsd: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions