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

[windows] Hot reload from terminal throws an exception on dev channel #75419

Closed
AminMoss-zz opened this issue Feb 4, 2021 · 7 comments
Closed
Labels
c: regression It was better in the past than it is now found in release: 1.26 Found to occur in 1.26 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-windows Building on or for Windows specifically t: hot reload Reloading code during "flutter run" tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@AminMoss-zz
Copy link

AminMoss-zz commented Feb 4, 2021

Steps to Reproduce

  1. Create New Flutter Project
  2. Make simple changes like changing 'pushed' to 'pushe' in the center string
  3. Hot Reload

Expected results: Hot Reload to work as expected, same changes on the same app work on web

Actual results: 1. When running in normal or debug mode from VS Code it will say it has reloaded but the app will just freeze without an exception and I have to restart the app to see the changes
2. When running from cmd the exception would be something like No constructor 'Text.' with matching arguments declared in class 'Text'
3. sometimes hot reload will work if I save and then click the hot reload button in VS Cide but it doesn't happen often

[   +2 ms] Performing hot reload...
[  +77 ms] Scanned through 511 files in 70ms
[   +2 ms] Syncing files to device Windows...
[        ] Compiling dart to kernel with 1 updated files
[   +1 ms] <- recompile package:ada/main.dart e51c4d80-3e2a-4067-aaf3-16b2aacb9160
[        ] package:ada/main.dart
[        ] <- e51c4d80-3e2a-4067-aaf3-16b2aacb9160
[  +44 ms] Updating files.
[   +6 ms] DevFS: Sync finished
[   +1 ms] Syncing files to device Windows... (completed in 54ms)
[        ] Synced 0.0MB.
[  +75 ms] <- accept
[   +2 ms] reloaded 1 of 548 libraries
[  +16 ms] Reassembling application
[  +88 ms]
           ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
           The following NoSuchMethodError was thrown building MyApp(dirty):
           No constructor 'StatefulWidget.' with matching arguments declared in class 'StatefulWidget'.
           Receiver: StatefulWidget
           Tried calling: new StatefulWidget.()
           Found: new StatefulWidget.({Key? key}) => StatefulWidget

           Widget creation tracking is currently disabled. Enabling it enables improved error messages. It can
           be enabled by passing `--track-widget-creation` to `flutter run` or `flutter test`.

           When the exception was thrown, this was the stack:
           #0      NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:212:5)
           #1      new MyHomePage (package:ada/main.dart)
           #2      MyApp.build (package:ada/main.dart:25:13)
           #3      StatelessElement.build (package:flutter/src/widgets/framework.dart:4569:28)
           #4      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
           #5      Element.rebuild (package:flutter/src/widgets/framework.dart:4189:5)
           #6      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2694:33)
           #7      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:873:21)
           #8      RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
           #9      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
           #10     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
           #11     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure>
(package:flutter/src/scheduler/binding.dart:865:7)
           (elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)

           ════════════════════════════════════════════════════════════════════════════════════════════════════
[  +25 ms] Hot reload performed in 335ms.
[   +1 ms] Performing hot reload... (completed in 344ms)
[   +1 ms] Reloaded 1 of 548 libraries in 353ms.

Analyzing ada...
No issues found! (ran in 1.7s)

[√] Flutter (Channel dev, 1.26.0-17.1.pre, on Microsoft Windows [Version 10.0.18363.1316], locale en-US)
    • Flutter version 1.26.0-17.1.pre at C:\SDKs\flutter
    • Framework revision c40e5294dd (6 days ago), 2021-01-29 08:44:18 -0800
    • Engine revision 5d3477eab4
    • Dart version 2.12.0 (build 2.12.0-259.0.dev)

[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.4)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.8.30907.101
    • Windows 10 SDK version 10.0.18362.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] VS Code (version 1.52.1)
    • VS Code at C:\Users\PC.M\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.19.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.18363.1316]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 88.0.4324.104
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 88.0.705.56

! Doctor found issues in 2 categories.
@TahaTesser
Copy link
Member

Hi @AminMoss
Your freeze issue could be #74797

Thanks for filing the issue, I cannot reproduce in VS Code but I can reproduce in Terminal on the dev channel, it doesn't occur on the master channel.

logs
[  +69 ms] DDS is listening at http://127.0.0.1:61761/1PHdN5ZKva8=/.
[  +61 ms] Successfully connected to service protocol: http://127.0.0.1:61756/JNMkq3PYFTA=/
[ +942 ms] DevFS: Creating new filesystem on the device (null)
[  +19 ms] DevFS: Created new filesystem on the device
(file:///C:/Users/Taha/AppData/Local/Temp/dev_flutter49d390c8/dev_flutter/)
[   +5 ms] Updating assets
[  +86 ms] Syncing files to device Windows...
[   +2 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[  +13 ms] <- recompile package:dev_flutter/main.dart 731458b9-7612-4bd6-8851-b14708907b52
[   +9 ms] <- 731458b9-7612-4bd6-8851-b14708907b52
[  +75 ms] Updating files.
[        ] DevFS: Sync finished
[   +1 ms] Syncing files to device Windows... (completed in 102ms)
[   +1 ms] Synced 0.0MB.
[   +8 ms] <- accept
[  +13 ms] Connected to _flutterView/0x1d2417f1b90.
[  +10 ms] Flutter run key commands.
[   +2 ms] r Hot reload. 
[  +12 ms] R Hot restart.
[  +23 ms] h Repeat this help message.
[   +3 ms] d Detach (terminate "flutter run" but leave application running).
[   +1 ms] c Clear the screen
[  +20 ms] q Quit (terminate the application on the device).
[  +10 ms] An Observatory debugger and profiler on Windows is available at: http://127.0.0.1:61761/1PHdN5ZKva8=/
[   +2 ms]
           Flutter DevTools, a Flutter debugger and profiler, on Windows is available at:
           http://127.0.0.1:9102?uri=http%3A%2F%2F127.0.0.1%3A61761%2F1PHdN5ZKva8%3D%2F
[   +2 ms] Running with unsound null safety
[  +12 ms] For more information see https://dart.dev/null-safety/unsound-null-safety
[+3648 ms] Skipping target: gen_localizations
[   +2 ms] complete
[   +2 ms] Performing hot reload...
[  +55 ms] Scanned through 511 files in 42ms
[   +1 ms] Syncing files to device Windows...
[   +1 ms] Compiling dart to kernel with 1 updated files
[   +8 ms] <- recompile package:dev_flutter/main.dart 7633264a-d901-483f-92f5-75919ab1aeb1
[   +1 ms] package:dev_flutter/main.dart
[   +1 ms] <- 7633264a-d901-483f-92f5-75919ab1aeb1
[  +38 ms] Updating files.
[   +4 ms] DevFS: Sync finished
[   +7 ms] Syncing files to device Windows... (completed in 60ms)
[        ] Synced 0.0MB.
[  +62 ms] <- accept
[   +2 ms] reloaded 1 of 548 libraries
[  +10 ms] Reassembling application
[  +57 ms] 
           ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
           The following NoSuchMethodError was thrown building MyApp(dirty):
           No constructor 'StatefulWidget.' with matching arguments declared in class 'StatefulWidget'.
           Receiver: StatefulWidget
           Tried calling: new StatefulWidget.()
           Found: new StatefulWidget.({Key? key}) => StatefulWidget

           Widget creation tracking is currently disabled. Enabling it enables improved error messages. It can
           be enabled by passing `--track-widget-creation` to `flutter run` or `flutter test`.

           When the exception was thrown, this was the stack:
           #0      NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:212:5)
           #1      new MyHomePage (package:dev_flutter/main.dart)
           #2      MyApp.build (package:dev_flutter/main.dart:25:13)
           #3      StatelessElement.build (package:flutter/src/widgets/framework.dart:4569:28)
           #4      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
           #5      Element.rebuild (package:flutter/src/widgets/framework.dart:4189:5)
           #6      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2694:33)
           #7      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:873:21)
           #8      RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
           #9      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
           #10     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
           #11     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:865:7) 
           (elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)

           ════════════════════════════════════════════════════════════════════════════════════════════════════
[  +66 ms] Hot reload performed in 305ms.
[  +11 ms] Performing hot reload... (completed in 323ms)
[   +1 ms] Reloaded 1 of 548 libraries in 338ms.
flutter doctor -v
[√] Flutter (Channel dev, 1.26.0-17.1.pre, on Microsoft Windows [Version 10.0.19042.746], locale en-US)
    • Flutter version 1.26.0-17.1.pre at C:\Users\Taha\Code\flutter_dev
    • Framework revision c40e5294dd (6 days ago), 2021-01-29 08:44:18 -0800
    • Engine revision 5d3477eab4
    • Dart version 2.12.0 (build 2.12.0-259.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Taha\Code\SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = C:\Users\Taha\Code\SDK
    • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.
[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.8.30804.86
    • Windows 10 SDK version 10.0.18362.0
[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Users\Taha\Code\android-studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.52.1)
    • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.19.0
[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.746]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 88.0.4324.104
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 88.0.705.53
• No issues found!

Thank you

@TahaTesser TahaTesser added found in release: 1.26 Found to occur in 1.26 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-windows Building on or for Windows specifically c: regression It was better in the past than it is now t: hot reload Reloading code during "flutter run" tool Affects the "flutter" command-line tool. See also t: labels. labels Feb 4, 2021
@AminMoss-zz
Copy link
Author

Been trying it for a while and it looks like it is my issue, did not get any freezes so far when I don't minimize.
Thank you for your response, hope the filing helped.

@TahaTesser TahaTesser changed the title Hot Reload for windows applications not working, causes app to become not responding [windows] Hot reload from terminal throws an exception Feb 5, 2021
@TahaTesser TahaTesser reopened this Feb 5, 2021
@TahaTesser
Copy link
Member

TahaTesser commented Feb 5, 2021

@AminMoss
Hot reload issue still exists from the terminal on the latest dev channel (doesn't occur on master), let's keep the issue open, and the freeze issue is also reopened

logs
[        ] Build succeeded.
[        ]     0 Warning(s)
[        ]     0 Error(s)
[        ] Time Elapsed 00:00:22.04
[  +19 ms] Building Windows application... (completed in 24.8s)
[ +335 ms] Observatory URL on device: http://127.0.0.1:55075/6T5k5UfFTAA=/
[   +4 ms] Caching compiled dill
[  +36 ms] Connecting to service protocol: http://127.0.0.1:55075/6T5k5UfFTAA=/
[ +112 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at
http://127.0.0.1:55075/6T5k5UfFTAA=/.
[  +73 ms] DDS is listening at http://127.0.0.1:55080/h3EidX_wUNk=/.
[  +48 ms] Successfully connected to service protocol: http://127.0.0.1:55075/6T5k5UfFTAA=/
[+1526 ms] DevFS: Creating new filesystem on the device (null)
[  +15 ms] DevFS: Created new filesystem on the device
(file:///C:/Users/Taha/AppData/Local/Temp/dev_flutterb2bd33a9/dev_flutter/)
[   +4 ms] Updating assets
[  +64 ms] Syncing files to device Windows...
[   +2 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +2 ms] <- recompile package:dev_flutter/main.dart f753223f-8c91-49d1-acb5-7c500fa86bc6
[        ] <- f753223f-8c91-49d1-acb5-7c500fa86bc6
[  +66 ms] Updating files.
[        ] DevFS: Sync finished
[   +1 ms] Syncing files to device Windows... (completed in 73ms)
[        ] Synced 0.0MB.
[   +1 ms] <- accept
[   +5 ms] Connected to _flutterView/0x1bcd197e060.
[   +1 ms] Flutter run key commands.
[   +1 ms] r Hot reload. 🔥🔥🔥
[   +1 ms] R Hot restart.
[        ] h Repeat this help message.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] An Observatory debugger and profiler on Windows is available at: http://127.0.0.1:55080/h3EidX_wUNk=/
[   +1 ms]
           Flutter DevTools, a Flutter debugger and profiler, on Windows is available at:
           http://127.0.0.1:9101?uri=http%3A%2F%2F127.0.0.1%3A55080%2Fh3EidX_wUNk%3D%2F
[        ] Running with unsound null safety
[        ] For more information see https://dart.dev/null-safety/unsound-null-safety
[+31637 ms] Skipping target: gen_localizations
[   +2 ms] complete
[   +1 ms] Performing hot reload...
[  +48 ms] Scanned through 511 files in 43ms
[   +1 ms] Syncing files to device Windows...
[        ] Compiling dart to kernel with 1 updated files
[   +1 ms] <- recompile package:dev_flutter/main.dart 8b637a04-0971-4a77-911a-19d73b64a94c
[        ] package:dev_flutter/main.dart
[        ] <- 8b637a04-0971-4a77-911a-19d73b64a94c
[  +32 ms] Updating files.
[   +2 ms] DevFS: Sync finished
[        ] Syncing files to device Windows... (completed in 39ms)
[        ] Synced 0.0MB.
[  +56 ms] <- accept
[   +1 ms] reloaded 1 of 548 libraries
[  +10 ms] Reassembling application
[  +57 ms]
           ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
           The following NoSuchMethodError was thrown building MyApp(dirty):
           No constructor 'StatefulWidget.' with matching arguments declared in class 'StatefulWidget'.
           Receiver: StatefulWidget
           Tried calling: new StatefulWidget.()
           Found: new StatefulWidget.({Key? key}) => StatefulWidget

           Widget creation tracking is currently disabled. Enabling it enables improved error messages. It can
           be enabled by passing `--track-widget-creation` to `flutter run` or `flutter test`.

           When the exception was thrown, this was the stack:
           #0      NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:212:5)
           #1      new MyHomePage (package:dev_flutter/main.dart)
           #2      MyApp.build (package:dev_flutter/main.dart:25:13)
           #3      StatelessElement.build (package:flutter/src/widgets/framework.dart:4569:28)
           #4      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
           #5      Element.rebuild (package:flutter/src/widgets/framework.dart:4189:5)
           #6      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2694:33)
           #7      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:873:21)
           #8      RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
           #9      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
           #10     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
           #11     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure>
(package:flutter/src/scheduler/binding.dart:865:7)
           (elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)

           ════════════════════════════════════════════════════════════════════════════════════════════════════
[  +16 ms] Hot reload performed in 227ms.
[        ] Performing hot reload... (completed in 233ms)
[   +1 ms] Reloaded 1 of 548 libraries in 240ms.
flutter doctor -v
[√] Flutter (Channel dev, 1.26.0-17.2.pre, on Microsoft Windows [Version 10.0.19042.746], locale en-US)
    • Flutter version 1.26.0-17.2.pre at C:\Users\Taha\Code\flutter_dev
    • Framework revision 79b49b9e10 (2 days ago), 2021-02-03 15:33:39 -0800
    • Engine revision 2c527d6c7e
    • Dart version 2.12.0 (build 2.12.0-259.8.beta)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Taha\Code\SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = C:\Users\Taha\Code\SDK
    • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.
[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.8.30804.86
    • Windows 10 SDK version 10.0.18362.0
[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Users\Taha\Code\android-studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.53.0)
    • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.19.0
[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.746]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 88.0.4324.146
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 88.0.705.53
• No issues found!

Thank you

@TahaTesser TahaTesser changed the title [windows] Hot reload from terminal throws an exception [windows] Hot reload from terminal throws an exception on dev channel Feb 5, 2021
@zanderso
Copy link
Member

zanderso commented Feb 5, 2021

@jonahwilliams do you happen to know which commit on master addressed this?

@jonahwilliams
Copy link
Member

Fixed by #75027 , though there was a workaround that landed several commits earlier.

@zanderso
Copy link
Member

zanderso commented Feb 5, 2021

Ah, right. The workaround is already lined-up for a cp onto the branch (#75157), so I will close this again.

@github-actions
Copy link

github-actions bot commented Aug 6, 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 Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: regression It was better in the past than it is now found in release: 1.26 Found to occur in 1.26 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-windows Building on or for Windows specifically t: hot reload Reloading code during "flutter run" tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

4 participants