question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compiler error when debugging build method during call to runApp

See original GitHub issue

Steps to Reproduce

I have this in main.dart in IntelliJ IDEA:

import 'package:flutter/widgets.dart';

void main() {
  runApp(MyWidget());
}

class MyWidget extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Container();
  }
}

I set a breakpoint on the return statement in build. When the debugger hits that point, I attempt to expand context in the debugger window or using the tooltip that pops up when I hover over context in the editor. When I do, the debugger disconnects and I get this error in my console:

14:52:41.736 9 info flutter.tools compiler message: Unhandled exception:
14:52:41.737 10 info flutter.tools compiler message: NoSuchMethodError: The getter 'className' was called on null.
14:52:41.737 11 info flutter.tools compiler message: Receiver: null
14:52:41.737 12 info flutter.tools compiler message: Tried calling: className
14:52:41.737 13 info flutter.tools compiler message: #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:48:5)
14:52:41.737 14 info flutter.tools compiler message: #1      serializeProcedure (package:front_end/src/fasta/kernel/utils.dart:82:29)
14:52:41.737 15 info flutter.tools compiler message: #2      FrontendCompiler.compileExpression (package:vm/frontend_server.dart:466:16)
14:52:41.737 16 info flutter.tools compiler message: <asynchronous suspension>
14:52:41.737 17 info flutter.tools compiler message: #3      _FlutterFrontendCompiler.compileExpression (package:frontend_server/server.dart:55:22)
14:52:41.737 18 info flutter.tools compiler message: #4      listenAndCompile.<anonymous closure> (package:vm/frontend_server.dart:664:20)
14:52:41.737 19 info flutter.tools compiler message: <asynchronous suspension>
14:52:41.737 20 info flutter.tools compiler message: #5      _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
14:52:41.737 21 info flutter.tools compiler message: #6      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
14:52:41.737 22 info flutter.tools compiler message: #7      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
14:52:41.737 23 info flutter.tools compiler message: #8      _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
14:52:41.737 24 info flutter.tools compiler message: #9      _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
14:52:41.737 25 info flutter.tools compiler message: #10     _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
14:52:41.737 26 info flutter.tools compiler message: #11     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:154:13)
14:52:41.737 27 info flutter.tools compiler message: #12     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:129:5)
14:52:41.737 28 info flutter.tools compiler message: #13     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:189:5)
14:52:41.737 29 info flutter.tools compiler message: #14     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
14:52:41.737 30 info flutter.tools compiler message: #15     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
14:52:41.737 31 info flutter.tools compiler message: #16     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
14:52:41.737 32 info flutter.tools compiler message: #17     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
14:52:41.737 33 info flutter.tools compiler message: #18     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
14:52:41.737 34 info flutter.tools compiler message: #19     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
14:52:41.737 35 info flutter.tools compiler message: #20     _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
14:52:41.737 36 info flutter.tools compiler message: #21     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:273:7)
14:52:41.737 37 info flutter.tools compiler message: #22     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:348:20)
14:52:41.737 38 info flutter.tools compiler message: #23     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:341:5)
14:52:41.737 39 info flutter.tools compiler message: #24     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86:18)
14:52:41.738 40 info flutter.tools compiler message: #25     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
14:52:41.739 41 info flutter.tools compiler message: #26     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
14:52:41.739 42 info flutter.tools compiler message: #27     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
14:52:41.739 43 info flutter.tools compiler message: #28     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
14:52:41.739 44 info flutter.tools compiler message: #29     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
14:52:41.739 45 info flutter.tools compiler message: #30     _StreamController._add (dart:async/stream_controller.dart:639:7)
14:52:41.739 46 info flutter.tools compiler message: #31     _StreamController.add (dart:async/stream_controller.dart:585:5)
14:52:41.740 47 info flutter.tools 
14:52:41.740 48 info flutter.tools compiler message: #32     _Socket._onData (dart:io/runtime/binsocket_patch.dart:1714:41)
14:52:41.742 49 info flutter.tools compiler message: #33     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
14:52:41.742 50 info flutter.tools compiler message: #34     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
14:52:41.742 51 info flutter.tools compiler message: #35     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
14:52:41.742 52 info flutter.tools 
14:52:41.744 53 info flutter.tools compiler message: #36     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
14:52:41.744 54 info flutter.tools compiler message: #37     _StreamController._add (dart:async/stream_controller.dart:639:7)
14:52:41.744 55 info flutter.tools compiler message: #38     _StreamController.add (dart:async/stream_controller.dart:585:5)
14:52:41.744 56 info flutter.tools 
14:52:41.745 57 info flutter.tools compiler message: #39     new _RawSocket.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:1276:33)
14:52:41.745 58 info flutter.tools compiler message: #40     _NativeSocket.issueReadEvent.issue (dart:io/runtime/binsocket_patch.dart:819:14)
14:52:41.745 59 info flutter.tools compiler message: #41     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
14:52:41.747 60 info flutter.tools 
14:52:41.747 61 info flutter.tools compiler message: #42     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
14:52:41.747 62 info flutter.tools compiler message: #43     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
14:52:41.747 63 info flutter.tools compiler message: #44     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
14:52:41.865 64 info flutter.tools Unhandled exception:
14:52:41.865 65 info flutter.tools SocketException: Write failed (OS Error: Broken pipe, errno = 32), port = 0
14:52:41.865 66 info flutter.tools #0      _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1112:29)
14:52:41.865 67 info flutter.tools #1      _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
14:52:41.865 68 info flutter.tools #2      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
14:52:41.865 69 info flutter.tools #3      _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
14:52:41.865 70 info flutter.tools #4      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)

Version info

[✓] Flutter (Channel beta, v0.7.3, on Mac OS X 10.13.6 17G65, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK 27.0.3) [✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1) [✓] Android Studio (version 3.1) [✓] IntelliJ IDEA Community Edition (version 2018.2.3) [!] VS Code (version 1.24.1) [✓] Connected devices (1 available)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
RedBrogdoncommented, Dec 11, 2018

I can no longer reproduce this in a post-1.0 world, so I’m guessing it’s been fixed.

Closing as obsolete.

0reactions
HerrNiklasRaabcommented, Nov 8, 2018

Same problem here, only in a more complex project. Any updates?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build and run your app - Android Developers
If an error occurs during the build process, Gradle may recommend command-line options to help you resolve the issue, such as --stacktrace or...
Read more >
How can I check if a Flutter application is running in debug?
I'm looking for a way to execute code in Flutter when the app is in Debug mode. Is that possible in Flutter? I...
Read more >
App works in debug mode but does not work in release mode
I am making a chat app..with firebase and CloudFirestore...in debug mode the app is working fine ..the chat and all is loading but...
Read more >
Debugging Flutter apps programmatically
You can call this more or less any time that the application is not in the middle of running a build phase (in...
Read more >
Fix program errors and improve code - Visual Studio (Windows)
You can use several step commands to execute code in the debugger. If the marked code is a method call, you can step...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found