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

[Bug]: Unable to retrieve windows info #2542

Open
8 tasks done
enricocenteni opened this issue Feb 1, 2024 · 6 comments
Open
8 tasks done

[Bug]: Unable to retrieve windows info #2542

enricocenteni opened this issue Feb 1, 2024 · 6 comments
Labels
bug Something isn't working triage

Comments

@enricocenteni
Copy link

Platform

Windows 10 virtualized (VirtualBox 7.0.10)

Plugin

device_info_plus

Version

9.1.2

Flutter SDK

3.16.4

Steps to reproduce

error occurred while retrieving Windows info using device_info_plus with the folowing error message

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Error 0x00000000: Operazione completata.
#0 DeviceInfoPlusWindowsPlugin.getSystemMemoryInMegabytes (package:device_info_plus/src/device_info_plus_windows.dart:128:9)
#1 DeviceInfoPlusWindowsPlugin.getInfo (package:device_info_plus/src/device_info_plus_windows.dart:88:34)
#2 DeviceInfoPlusWindowsPlugin.deviceInfo (package:device_info_plus/src/device_info_plus_windows.dart:40:36)
#3 DeviceInfoPlugin.windowsInfo (package:device_info_plus/device_info_plus.dart:93:27)
#4 getDeviceInfo (package:myProject/lib/lib1.dart:391:47)
#5 main (package:myProject/main.dart:52:15)

Code Sample

Code to reproduce error

Future<String> getDeviceInfo() async {
  DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
  WindowsDeviceInfo info = await deviceInfo.windowsInfo; // lib1.dart, line 391

...

}

on android the same code is working (using androidInfo obviously)

Logs

PS C:\Users\Enrico\Desktop\ProgettiAndroidStudio\myProject> flutter run --verbose

....


IO  : Writing 160013 characters to text file C:\Users\Enrico\AppData\Local\Pub\Cache\log\pub_log.txt.
MSG : Logs written to C:\Users\Enrico\AppData\Local\Pub\Cache\log\pub_log.txt.
[+2593 ms] Found plugin connectivity_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\connectivity_plus-5.0.2\
[  +35 ms] Found plugin device_info_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\device_info_plus-9.1.2\
[   +8 ms] Found plugin flutter_beep at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_beep-1.0.0\
[   +4 ms] Found plugin flutter_internet_signal at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_internet_signal-0.0.30\
[  +54 ms] Found plugin network_info_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\network_info_plus-4.1.0+1\
[   +7 ms] Found plugin package_info_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\package_info_plus-5.0.1\
[   +7 ms] Found plugin path_provider at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider-2.1.2\
[   +1 ms] Found plugin path_provider_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_android-2.2.2\
[   +2 ms] Found plugin path_provider_foundation at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_foundation-2.3.2\
[   +2 ms] Found plugin path_provider_linux at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_linux-2.2.1\
[  +33 ms] Found plugin path_provider_windows at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_windows-2.2.1\
[  +10 ms] Found plugin permission_handler at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler-11.2.0\
[  +11 ms] Found plugin permission_handler_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.3\
[  +16 ms] Found plugin permission_handler_apple at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_apple-9.3.0\
[  +21 ms] Found plugin permission_handler_html at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_html-0.1.1\
[   +2 ms] Found plugin permission_handler_windows at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_windows-0.2.1\
[   +7 ms] Found plugin shared_preferences at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences-2.2.2\
[   +1 ms] Found plugin shared_preferences_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_android-2.2.1\
[   +1 ms] Found plugin shared_preferences_foundation at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_foundation-2.3.5\
[   +1 ms] Found plugin shared_preferences_linux at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_linux-2.3.2\
[   +2 ms] Found plugin shared_preferences_web at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_web-2.2.2\
[   +1 ms] Found plugin shared_preferences_windows at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_windows-2.3.2\
[   +8 ms] Found plugin url_launcher at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher-6.2.4\
[   +1 ms] Found plugin url_launcher_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_android-6.2.2\
[   +1 ms] Found plugin url_launcher_ios at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_ios-6.2.4\
[   +1 ms] Found plugin url_launcher_linux at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_linux-3.1.1\
[   +1 ms] Found plugin url_launcher_macos at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_macos-3.1.0\
[   +2 ms] Found plugin url_launcher_web at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_web-2.2.3\
[   +1 ms] Found plugin url_launcher_windows at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_windows-3.1.1\
[   +2 ms] Found plugin wakelock_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\wakelock_plus-1.1.4\
[   +4 ms] Found plugin webview_flutter at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter-4.4.4\
[   +1 ms] Found plugin webview_flutter_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter_android-3.14.0\
[   +2 ms] Found plugin webview_flutter_wkwebview at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter_wkwebview-3.10.2\
[  +57 ms] Found plugin connectivity_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\connectivity_plus-5.0.2\
[   +8 ms] Found plugin device_info_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\device_info_plus-9.1.2\
[   +5 ms] Found plugin flutter_beep at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_beep-1.0.0\
[   +1 ms] Found plugin flutter_internet_signal at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_internet_signal-0.0.30\
[  +12 ms] Found plugin network_info_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\network_info_plus-4.1.0+1\
[   +3 ms] Found plugin package_info_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\package_info_plus-5.0.1\
[   +4 ms] Found plugin path_provider at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider-2.1.2\
[   +1 ms] Found plugin path_provider_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_android-2.2.2\
[   +1 ms] Found plugin path_provider_foundation at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_foundation-2.3.2\
[   +1 ms] Found plugin path_provider_linux at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_linux-2.2.1\
[   +2 ms] Found plugin path_provider_windows at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_windows-2.2.1\
[   +2 ms] Found plugin permission_handler at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler-11.2.0\
[   +1 ms] Found plugin permission_handler_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_android-12.0.3\
[   +1 ms] Found plugin permission_handler_apple at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_apple-9.3.0\
[   +1 ms] Found plugin permission_handler_html at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_html-0.1.1\
[   +1 ms] Found plugin permission_handler_windows at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\permission_handler_windows-0.2.1\
[   +7 ms] Found plugin shared_preferences at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences-2.2.2\
[   +1 ms] Found plugin shared_preferences_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_android-2.2.1\
[   +1 ms] Found plugin shared_preferences_foundation at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_foundation-2.3.5\
[   +1 ms] Found plugin shared_preferences_linux at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_linux-2.3.2\
[   +1 ms] Found plugin shared_preferences_web at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_web-2.2.2\
[   +1 ms] Found plugin shared_preferences_windows at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\shared_preferences_windows-2.3.2\
[   +5 ms] Found plugin url_launcher at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher-6.2.4\
[   +1 ms] Found plugin url_launcher_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_android-6.2.2\
[   +1 ms] Found plugin url_launcher_ios at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_ios-6.2.4\
[   +1 ms] Found plugin url_launcher_linux at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_linux-3.1.1\
[   +1 ms] Found plugin url_launcher_macos at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_macos-3.1.0\
[   +1 ms] Found plugin url_launcher_web at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_web-2.2.3\
[   +1 ms] Found plugin url_launcher_windows at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\url_launcher_windows-3.1.1\
[   +2 ms] Found plugin wakelock_plus at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\wakelock_plus-1.1.4\
[   +3 ms] Found plugin webview_flutter at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter-4.4.4\
[   +1 ms] Found plugin webview_flutter_android at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter_android-3.14.0\
[   +2 ms] Found plugin webview_flutter_wkwebview at C:\Users\Enrico\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter_wkwebview-3.10.2\
[  +77 ms] Generating C:\Users\Enrico\Desktop\ProgettiAndroidStudio\myProject\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[ +120 ms] Initializing file store
[   +2 ms] gen_localizations: Starting due to {}
[ +495 ms] "fr": 1 untranslated message(s).
[        ] "it": 1 untranslated message(s).
[        ] To see a detailed report, use the untranslated-messages-file 
           option in the l10n.yaml file:
           untranslated-messages-file: desiredFileName.txt
           <other option>: <other selection> 


....

[  +22 ms] Building Windows application... (completed in 72,1s)
[   +2 ms] √  Built build\windows\x64\runner\Debug\my_project.exe.
[ +544 ms] VM Service URL on device: http://127.0.0.1:64342/VEber-TF1b4=/
[   +4 ms] Caching compiled dill
[  +38 ms] Connecting to service protocol: http://127.0.0.1:64342/VEber-TF1b4=/
[ +106 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:64342/VEber-TF1b4=/.
[  +79 ms] DDS is listening at http://127.0.0.1:64345/YFxuuUX2088=/.
[  +50 ms] [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Error 0x00000000: Operazione completata.
[        ] #0      DeviceInfoPlusWindowsPlugin.getSystemMemoryInMegabytes (package:device_info_plus/src/device_info_plus_windows.dart:128:9)
[   +2 ms] #1      DeviceInfoPlusWindowsPlugin.getInfo (package:device_info_plus/src/device_info_plus_windows.dart:88:34)
[        ] #2      DeviceInfoPlusWindowsPlugin.deviceInfo (package:device_info_plus/src/device_info_plus_windows.dart:40:36)
[        ] #3      DeviceInfoPlugin.windowsInfo (package:device_info_plus/device_info_plus.dart:93:27)
[        ] #4      getDeviceInfo (package:myProject/hmi/lib/lib1.dart:391:47)
[        ] #5      main (package:myProject/main.dart:52:15)
[        ] <asynchronous suspension>
[  +36 ms] Successfully connected to service protocol: http://127.0.0.1:64342/VEber-TF1b4=/
[  +21 ms] DevFS: Creating new filesystem on the device (null)
[  +17 ms] DevFS: Created new filesystem on the device (file:///C:/Users/Enrico/AppData/Local/Temp/myProjectbab8b6c0/myProject/)
[   +6 ms] Updating assets
[ +446 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466.
[  +14 ms] Syncing files to device Windows...
[   +2 ms] Compiling dart to kernel with 0 updated files
[        ] Processing bundle.
[   +1 ms] <- recompile package:myProject/main.dart fbe43801-fcde-4a2a-89b0-1505b506ae4b
[        ] <- fbe43801-fcde-4a2a-89b0-1505b506ae4b
[  +92 ms] Bundle processing done.
[ +244 ms] Updating files.
[   +1 ms] DevFS: Sync finished
[   +1 ms] Syncing files to device Windows... (completed in 343ms)
[        ] Synced 0.0MB.
[   +1 ms] <- accept
[   +3 ms] Connected to _flutterView/0x29d69a7d6a0.
[   +2 ms] Flutter run key commands.
[  +17 ms] r Hot reload. 
[   +3 ms] R Hot restart.
[   +3 ms] h List all available interactive commands.
[   +1 ms] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[   +1 ms] q Quit (terminate the application on the device).
[   +6 ms] A Dart VM Service on Windows is available at: http://127.0.0.1:64345/YFxuuUX2088=/
[   +1 ms] The Flutter DevTools debugger and profiler on Windows is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:64345/YFxuuUX2088=/

Flutter Doctor

[√] Flutter (Channel stable, 3.16.4, on Microsoft Windows [Versione 10.0.19045.3930], locale it-IT)
    • Flutter version 3.16.4 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2e9cb0aa71 (7 weeks ago), 2023-12-11 14:35:13 -0700
    • Engine revision 54a7145303
    • Dart version 3.2.3
    • DevTools version 2.28.4

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\Enrico\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.6)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34221.43
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2022.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 17.0.6+0-b2043.56-10027231)

[√] Connected device (4 available)
    • TAB KINGKONG (mobile) • TKK230921001877 • android-arm64  • Android 13 (API 33)
    • Windows (desktop)     • windows         • windows-x64    • Microsoft Windows [Versione 10.0.19045.3930]
    • Chrome (web)          • chrome          • web-javascript • Google Chrome 120.0.6099.227
    • Edge (web)            • edge            • web-javascript • Microsoft Edge 121.0.2277.83

[√] Network resources
    • All expected network resources are available.

• No issues found!

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@enricocenteni enricocenteni added bug Something isn't working triage labels Feb 1, 2024
@vbuberen
Copy link
Collaborator

vbuberen commented Feb 1, 2024

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Error 0x00000000: Operazione completata.

This looks like some access permission issue according to logs. Have you search this error?
Also, I am not sure if plugin is supposed to work alright in virtual environments.

@enricocenteni
Copy link
Author

@vbuberen In the plugin documentation I don't see any particular setup for permissions on Windows. Furthermore, the method should return a string (even just "unknown" or something), not crash.
It seems to crash while requesting memory information.

#0 DeviceInfoPlusWindowsPlugin.getSystemMemoryInMegabytes (package:device_info_plus/src/device_info_plus_windows.dart:128:9)

It could be a problem with virtualbox

@vbuberen
Copy link
Collaborator

vbuberen commented Feb 2, 2024

In the plugin documentation I don't see any particular setup for permissions on Windows. Furthermore, the method should return a string (even just "unknown" or something), not crash.

The thing is I am not the only one working on plugins and I don't really involved in Windows part of things. I shared with you what I found about the error you have seen. Presumably, you should have also seen it as you marked that Googled the error in the checkbox. Thanks for stating the obvious thing on how the plugin should work, but the tone of your message feels like demanding to me. If that is so, you are free to open a PR and resolve the issue, thus, help other people with similar setups.

@vbuberen
Copy link
Collaborator

vbuberen commented Feb 4, 2024

Could I ask you to check if this plugin works Ok in the setup you have with VirtualBox?
https://github.com/onepub-dev/system_info

I am not really familiar with Windows development and currently don't have anyone to help here, but would like to address the issue you encountered. Thus, would appreciate the feedback if that other plugin works fine for you.

@cstichlberger
Copy link

It's an issue with the VM that can be solved with the following (turn off VM first)

VBoxManage setextradata "<nameofVM>" "VBoxInternal/Devices/efi/0/Config/DmiExposeMemoryTable" "1"

From https://forums.virtualbox.org/viewtopic.php?t=107885

Before that, I had the same issue:

Error 0x8007000d: The data is invalid.
#0 Device]nfoPIusWindowsPlugin.getSystemMemorylnMegabytes (package:device_info_plus/src/device_info_p|us_windows.dart:128)
#1 DevicelnfoPlusWindowsPlugin.get|nfo (package:device_info_p|us/src/device_info_p|us_windows.dart:88)
#2 DevicelnfoPlusWindowsPlugin.devicelnfo (package:device_info_p|us/src/device_info_plus_windows.dart:40)
#3 DevicelnfoPluginJinuxlnfo (package:device_info_p|us/device_info_p|us.dart:72)

Happens only in my VM (Win11 within VirtualBox 7 on Ubuntu 23.04), on a regular Windows machine the same executable works. Its an issue with Window/VirtualBox, the same WinApi call GetPhysicallyInstalledSystemMemory that's producing the error in the plugin also fails when calling it from a C# application.

Therefore you can close this issue, it's got little to do with this flutter plugin.

@miquelbeltran
Copy link
Member

One possible "fix" is that the getSystemMemoryInMegabytes in device_info_plus_windows.dart fails silently with a 0 rather than throwing an exception. At least it would make the plugin usable in a VM, even if the memory value is wrong.

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

No branches or pull requests

4 participants