fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.

Home Page:https://fzyzcjy.github.io/flutter_rust_bridge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Turning off App Sandbox on macos causes error

JohnnnyWang opened this issue · comments

Describe the bug

I turned off the App Sandbox under Runner in xcode on macos (M2 Max chip, latest version of operating system)
When I run I get the following error

thread '<unnamed>' panicked at /Users/xxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge-2.0.0-dev.22/src/codec/sse.rs:129:9:
assertion `left == right` failed
  left: 384
 right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PanicException(assertion `left == right` failed
  left: 384
 right: 0)
#0      SimpleDecoder.decode (package:flutter_rust_bridge/src/codec/base.dart:35:9)
#1      SseCodec._decode (package:flutter_rust_bridge/src/codec/sse.dart:42:55)
#2      SseCodec.decodeObject (package:flutter_rust_bridge/src/codec/sse.dart:32:12)
<asynchronous suspension>
#3      HomeController.doLogin (package:xxx/src/dart/controller/home/controller.dart:39:7)

Steps to reproduce

  1. turned off the App Sandbox under Runner in xcode

Logs

thread '<unnamed>' panicked at /Users/xxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge-2.0.0-dev.22/src/codec/sse.rs:129:9:
assertion `left == right` failed
  left: 384
 right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PanicException(assertion `left == right` failed
  left: 384
 right: 0)
#0      SimpleDecoder.decode (package:flutter_rust_bridge/src/codec/base.dart:35:9)
#1      SseCodec._decode (package:flutter_rust_bridge/src/codec/sse.dart:42:55)
#2      SseCodec.decodeObject (package:flutter_rust_bridge/src/codec/sse.dart:32:12)
<asynchronous suspension>
#3      HomeController.doLogin (package:xxx/src/dart/controller/home/controller.dart:39:7)

Expected behavior

No response

Generated binding code

No response

OS

MacOs

Version of flutter_rust_bridge_codegen

dev.22

Flutter info

No response

Version of clang++

No response

Additional context

No response

Hi, could you please provide a minimal reproducible sample? For example, fork and slightly modify the https://github.com/fzyzcjy/flutter_rust_bridge/tree/master/frb_example/flutter_via_create example (e.g. turn off sandbox) and flutter run.

Ops, first of all I have solved the problem by

flutter clean
cargo clean

and
Delete the three frb_generated files of dart and rust (6 in total)
At this point the error disappears.

But before that, if you don't delete the frb_* files and just run the clean command, it won't work.

Hmm that's weird... Btw do you re-generate the files later?

Without more information, I may just guess it is due to some weird compilation cache... But if you have a minimal reproducible sample, I am happy to examine more!

I'd really like to provide a minimal program to reproduce.
But on a minimal program I use the same steps without error.

Maybe I can close this issue first, and I will open it again when I have other findings.

Sure, take your time!

Hmm, it seems that rust’s compilation cache will have an impact? Sometimes I change the rust code and generate it directly, and this problem will occur.
I ran: Cargo clean, then deleted the frb_* files, and then generated them again and everything was fine again.

Ah, it's hard to reproduce...

Hmm...

deleted the frb_* files, and then generated them again

Do the files change, or are they exactly the same?

The next time an error occurs, I will pay attention to the changes in the frb_* files and try to provide a complete reproduction process or a more specific description. If so, I will continue to reply to this issue.

Sure!

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 issue.