-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: desktopRunning on desktopRunning on desktopa: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsc: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 2.0Found to occur in 2.0Found to occur in 2.0has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-macBuilding on or for macOS specificallyBuilding on or for macOS specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
When porting an iOS plugin using pigeon I stumbled over the following issue:
(A full reproduction repo can be found at: https://github.com/cbenhagen/null_message)
Consider the following simplified initialize method.
class NullMessage {
static Future<void> initialize() async {
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'com.example.initialize', StandardMessageCodec());
await channel.send(null);
}
}with its macOS counterpart:
public class NullMessagePlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterBasicMessageChannel.init(name: "com.example.initialize", binaryMessenger: registrar.messenger)
channel.setMessageHandler { (_ message, callback) in
print("Initializing..")
callback(["result": nil, "error": nil])
}
}
}This crashes with:
2021-03-12 08:53:43.808 null_message_example[15413:652621] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[_NSZeroData getBytes:range:]: range {0, 1} exceeds data length 0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff204f4083 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff2022c17c objc_exception_throw + 48
2 Foundation 0x00007fff2113704d -[NSData(NSData) getBytes:length:] + 0
3 FlutterMacOS 0x000000010d65dd13 -[FlutterStandardReader readBytes:length:] + 51
4 FlutterMacOS 0x000000010d65dd6c -[FlutterStandardReader readByte] + 44
5 FlutterMacOS 0x000000010d65e05f -[FlutterStandardReader readValue] + 47
6 FlutterMacOS 0x000000010d65bcf3 -[FlutterStandardMessageCodec decode:] + 83
7 FlutterMacOS 0x000000010d658b79 __48-[FlutterBasicMessageChannel setMessageHandler:]_block_invoke + 57
8 FlutterMacOS 0x000000010ca95298 -[FlutterEngine engineCallbackOnPlatformMessage:] + 264
9 FlutterMacOS 0x000000010ca93d2c _ZL17OnPlatformMessagePK22FlutterPlatformMessageP13FlutterEngine + 44
10 FlutterMacOS 0x000000010d2af35d _ZNSt3__110__function6__funcIZ23FlutterEngineInitializeE4$_44NS_9allocatorIS2_EEFvN3fml6RefPtrIN7flutter15PlatformMessageEEEEEclEOS9_ + 125
11 FlutterMacOS 0x000000010d2c077a _ZN7flutter20PlatformViewEmbedder21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 74
12 FlutterMacOS 0x000000010d0250d9 _ZNSt3__110__function6__funcIZN7flutter5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrINS2_15PlatformMessageEEEE4$_38NS_9allocatorIS8_EEFvvEEclEv + 137
13 FlutterMacOS 0x000000010d2bdbc7 _ZN7flutter18EmbedderTaskRunner8PostTaskEy + 759
14 FlutterMacOS 0x000000010d2a5ddc FlutterEngineRunTask + 44
15 FlutterMacOS 0x000000010ca96317 __60-[FlutterEngine postMainThreadTask:targetTimeInNanoseconds:]_block_invoke + 71
16 libdispatch.dylib 0x00007fff201d55dd _dispatch_call_block_and_release + 12
17 libdispatch.dylib 0x00007fff201d67c7 _dispatch_client_callout + 8
18 libdispatch.dylib 0x00007fff201e2b86 _dispatch_main_queue_callback_4CF + 940
19 CoreFoundation 0x00007fff204b7356 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
20 CoreFoundation 0x00007fff20479188 __CFRunLoopRun + 2745
21 CoreFoundation 0x00007fff20477fe2 CFRunLoopRunSpecific + 567
22 HIToolbox 0x00007fff28946630 RunCurrentEventLoopInMode + 292
23 HIToolbox 0x00007fff2894642c ReceiveNextEventCommon + 709
24 HIToolbox 0x00007fff2894614f _BlockUntilNextEventMatchingListInModeWithFilter + 64
25 AppKit 0x00007fff22bcd9b1 _DPSNextEvent + 883
26 AppKit 0x00007fff22bcc177 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1366
27 AppKit 0x00007fff22bbe68a -[NSApplication run] + 586
28 AppKit 0x00007fff22b9296f NSApplicationMain + 816
29 null_message_example 0x00000001047a05ad main + 13
30 libdyld.dylib 0x00007fff2039d621 start + 1
31 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Lost connection to device.
Sending a null message on iOS works as expected.
[✓] Flutter (Channel master, 2.1.0-11.0.pre.229, on macOS 11.2.2 20D80 darwin-arm, locale en-CH)
• Flutter version 2.1.0-11.0.pre.229 at /Users/ben/development/flutter
• Framework revision d20ec4c7d8 (2 hours ago), 2021-03-11 22:18:51 -0800
• Engine revision 1b68503bc8
• Dart version 2.13.0 (build 2.13.0-125.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/ben/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Users/ben/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Users/ben/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents
• 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-b3-6915495)
[✓] VS Code (version 1.53.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.19.0
[✓] Connected device (3 available)
• iPhone 12 Pro Max (mobile) • 68EC88D5-EC52-4B0C-81AD-03EC47E837BA • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 11.2.2 20D80 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.82
• No issues found!
nilsreichardt
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: desktopRunning on desktopRunning on desktopa: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsc: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 2.0Found to occur in 2.0Found to occur in 2.0has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-macBuilding on or for macOS specificallyBuilding on or for macOS specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version