Skip to content

Message about illegal objects being sent to isolate should refer to local variable names #52957

Closed
@aam

Description

@aam

As a follow-up to #51115 and in hopes to ease the pain of #36983 (#36983 (comment)) the message should refer to local variables that are on the path to captured context.

So the example generated exception should reference variable x:

$ cat s.dart
import 'dart:isolate';

foo() {
  final x = RawReceivePort();
  RawReceivePort().sendPort.send(() => print("$x"));
}

main() {
   foo();
}
$ out/ReleaseX64/dart s.dart
Unhandled exception:
Invalid argument(s): Illegal argument in isolate message: (object is a ReceivePort)
 <- Context num_variables: 1
 <- Closure: () => void (from dart:core)

#0      _SendPort._sendInternal (dart:isolate-patch/isolate_patch.dart:244:43)
#1      _SendPort.send (dart:isolate-patch/isolate_patch.dart:225:5)
#2      foo (file:///usr/local/google/home/aam/p/d/dart-sdk/sdk/s.dart:5:29)
#3      main (file:///usr/local/google/home/aam/p/d/dart-sdk/sdk/s.dart:9:4)
#4      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:291:19)
#5      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-isolate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions