Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot Reload error? #7551

Closed
Reagankm opened this issue Jan 19, 2017 · 9 comments
Closed

Hot Reload error? #7551

Reagankm opened this issue Jan 19, 2017 · 9 comments

Comments

@Reagankm
Copy link
Contributor

Reagankm commented Jan 19, 2017

Steps to Reproduce

I was trying to assign a Navigator.pushNamed action to an InkWell's onTap and I initially did it wrong, writing:

new InkWell(onTap: Navigator.pushNamed(context, NavigationRoutes.insertionOrderList),

When I tapped the item in my emulator, I got an error, as I should.

Then, realizing my mistake, I changed my code to

new InkWell(onTap: () {Navigator.pushNamed(context, NavigationRoutes.insertionOrderList);}

and I hit 'r' in the console to do a hot reload. This gave me the following error:

I/flutter (26237): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (26237): The following assertion was thrown building Navigator([GlobalObjectKey
I/flutter (26237): _WidgetsAppState(821359005)]; dirty; state: NavigatorState(1035961383; tracking 8 tickers)):
I/flutter (26237): 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 708 pos 12: '!_debugLocked' is
I/flutter (26237): not true.
I/flutter (26237):
I/flutter (26237): When the exception was thrown, this was the stack:
I/flutter (26237): #2 NavigatorState.build (package:flutter/src/widgets/navigator.dart:708:12)
I/flutter (26237): #3 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2895:23)
I/flutter (26237): #4 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #5 StatefulElement.update (package:flutter/src/widgets/framework.dart:3032:5)
I/flutter (26237): #6 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #7 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #8 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #9 StatelessElement.update (package:flutter/src/widgets/framework.dart:2951:5)
I/flutter (26237): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #11 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #12 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #13 ProxyElement.update (package:flutter/src/widgets/framework.dart:3150:5)
I/flutter (26237): #14 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #15 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #16 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #17 ProxyElement.update (package:flutter/src/widgets/framework.dart:3150:5)
I/flutter (26237): #18 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #19 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #20 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #21 ProxyElement.update (package:flutter/src/widgets/framework.dart:3150:5)
I/flutter (26237): #22 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #23 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:3850:14)
I/flutter (26237): #24 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #25 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #26 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #27 StatelessElement.update (package:flutter/src/widgets/framework.dart:2951:5)
I/flutter (26237): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #29 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #30 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #31 StatelessElement.update (package:flutter/src/widgets/framework.dart:2951:5)
I/flutter (26237): #32 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #33 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #34 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #35 StatefulElement.update (package:flutter/src/widgets/framework.dart:3032:5)
I/flutter (26237): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #37 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #38 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #39 ProxyElement.update (package:flutter/src/widgets/framework.dart:3150:5)
I/flutter (26237): #40 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #41 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #42 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #43 StatefulElement.update (package:flutter/src/widgets/framework.dart:3032:5)
I/flutter (26237): #44 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #45 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #46 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #47 ProxyElement.update (package:flutter/src/widgets/framework.dart:3150:5)
I/flutter (26237): #48 Element.updateChild (package:flutter/src/widgets/framework.dart:2069:15)
I/flutter (26237): #49 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16)
I/flutter (26237): #50 BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5)
I/flutter (26237): #51 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:1769:33)
I/flutter (26237): #52 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding&WidgetsBinding.beginFrame (package:flutter/src/widgets/binding.dart:313:20)
I/flutter (26237): #53 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:165:5)
I/flutter (26237): #54 BindingBase&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:652:15)
I/flutter (26237): #55 BindingBase&SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:587:9)
I/flutter (26237): #56 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding.reassembleApplication (package:flutter/src/rendering/binding.dart:231:5)
I/flutter (26237): #57 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding&WidgetsBinding.reassembleApplication (package:flutter/src/widgets/binding.dart:362:32)
I/flutter (26237): #58 BindingBase.registerSignalServiceExtension..<_async_body> (package:flutter/src/foundation/binding.dart:151)
I/flutter (26237): (elided 5 frames from class _AssertionError and package dart:async)
I/flutter (26237): ════════════════════════════════════════════════════════════════════════════════════════════════════

When I just canceled the run, though, and rebuilt from scratch it builds and works correctly.

Maybe this is related to issue 4891? I don't know, that's just the only thing I found when trying to search for my error message.

@eseidelGoogle
Copy link
Contributor

@johnmccutchan @Hixie

@johnmccutchan
Copy link
Contributor

johnmccutchan commented Jan 20, 2017

@Hixie is there a way to make the framework recover from the user error?

@Hixie
Copy link
Contributor

Hixie commented Jan 20, 2017

We could add try/catch blocks in even more places to try to keep the badness contained. But fundamentally it's always possible to get the framework into an inconsistent state if you throw half-way through a frame or pointer event handling, and then you have to restart.

If we have specific cases of bad code causing hot reload to fail, I'm happy to look at them and see if in those specific cases we can improve matters.

@johnmccutchan
Copy link
Contributor

@Reagankm Did the analyzer not warn you that your code contained errors?

@Hixie
Copy link
Contributor

Hixie commented Jan 21, 2017

It's trivial to write code that the analyzer is happy with but which will freak the framework out.

@Reagankm
Copy link
Contributor Author

@johnmccutchan I didn't see any such warning, but I'm running the code from google3 so don't have access to the "flutter analyze" command. Maybe there's some other way I'm supposed to be checking that.

@johnmccutchan
Copy link
Contributor

@Reagankm Certain editors have the Dart analyzer integrated directly so you see it as you write your code.

As @Hixie said some code is going to break the framework. But, if the analyzer had warned you, at least would be a clue that you might be submitting busted code.

@Hixie
Copy link
Contributor

Hixie commented Feb 28, 2017

I'm not sure what to do in response to this bug. If there is a specific case you think we should handle better, please file a new bug with specific steps.

@Hixie Hixie closed this as completed Feb 28, 2017
@github-actions
Copy link

github-actions bot commented Sep 5, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants