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

Flutter Windows Lost connection to device #313

Open
Hopheylalal opened this issue May 10, 2024 · 6 comments
Open

Flutter Windows Lost connection to device #313

Hopheylalal opened this issue May 10, 2024 · 6 comments
Labels
bug Something isn't working Windows

Comments

@Hopheylalal
Copy link

Hello
record 5.0.5

Environment

  • windows
  • Flutter 3.19.6

get Lost connection to device after starting record

@llfbandit
Copy link
Owner

Try to start your app from Visual Studio to get log and stacktrace.
From here, I will be able to investigate otherwise I will close this issue.

@6th-kate
Copy link

Hello, I am facing the same "Lost connection to device" crash

dart: >=3.3.1 <4.0.0
flutter: >=3.19.0
record: ^5.1.1
windows 10

Exception thrown: read access violation.
pSinkWriter was nullptr.

The stacktrace:

record_windows_plugin.dll!record_windows::Recorder::CreateSinkWriter(std::string path) Line 397	C++
record_windows_plugin.dll!record_windows::Recorder::Start(std::unique_ptr<record_windows::RecordConfig,std::default_delete<record_windows::RecordConfig>> config, std::string path) Line 81	C++
record_windows_plugin.dll!record_windows::RecordWindowsPlugin::HandleMethodCall(const flutter::MethodCall<flutter::EncodableValue> & method_call, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>,std::default_delete<flutter::MethodResult<flutter::EncodableValue>>> result) Line 134	C++
record_windows_plugin.dll!<lambda_1165fad256d06266751221916df127db>::operator()<flutter::MethodCall<flutter::EncodableValue>,std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>,std::default_delete<flutter::MethodResult<flutter::EncodableValue>>>>(const flutter::MethodCall<flutter::EncodableValue> & call, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>,std::default_delete<flutter::MethodResult<flutter::EncodableValue>>> result) Line 45	C++
[External Code]	
record_windows_plugin.dll!flutter::MethodChannel<flutter::EncodableValue>::SetMethodCallHandler::__l2::<lambda>(const unsigned char * message, unsigned __int64 message_size, std::function<void __cdecl(unsigned char const *,unsigned __int64)> reply) Line 121	C++
[External Code]	
record_windows_plugin.dll!flutter::`anonymous namespace'::ForwardToHandler(FlutterDesktopMessenger * messenger, const FlutterDesktopMessage * message, void * user_data) Line 76	C++
[External Code]	
myapp.exe!wWinMain(HINSTANCE__ * instance, HINSTANCE__ * prev, wchar_t * command_line, int show_command) Line 39	C++
[External Code]	

Might it be that I don't have some of standard Windows utilities installed which I'm not knowing about?

@llfbandit
Copy link
Owner

Thanks for the stack trace. There's a missing check when starting the recording.

It seems that the given path is problematic.
Are you trying to record to a protected folder? To confirm this (and workaround for now), can try to record in a public folder?

@llfbandit
Copy link
Owner

record_windows 1.0.3 has been released to fix the crash and forward the underlying error on Dart side.

@6th-kate
Copy link

6th-kate commented Jun 8, 2024

Thank you for your response and the record_windows update! I was able to secure my users' experience by handling this exception.

This turned out to be a "Path not found" error. I am not actually sure about its reason, got this thrown while trying to record audios into the "documents" directory, returned by path_provider getApplicationDocumentsDirectory().

It might be one of the two things:

  1. This directory is synchronized with my OneDrive cloud, therefore, the returned path contains "OneDrive". Not completely sure if this folder is virtual, but it may occur due to some privacy settings.
  2. My Windows uses locale with Cyrillic symbols, so the path in my terminal is shown like this: C:\Users\<username>\OneDrive\Документи. At the same time, the path I get from path_provider looks like the following: C:\Users\<username>\OneDrive\Documents. This duality is managed by most of inbuilt utilities, though sometimes it is still causing errors.

However, dart:io has been able to create folders and files in the same directory. Also, archive plugin successfully unzipped data in there. Is this caused by MediaFoundation at some point? Writing in other folders like C:\workspace\myapp works perfectly well.

Hope this might help.

@llfbandit llfbandit added the bug Something isn't working label Jun 22, 2024
@llfbandit
Copy link
Owner

Sorry for the late reply, I bet on the encoding issue since dart/native communication is UTF8 only.
I will try to use pigeon to workaround those fuzzy issues on windows platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows
Projects
None yet
Development

No branches or pull requests

3 participants