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

Windows crashing issue #1388

Open
krll-kov opened this issue Sep 27, 2024 · 1 comment
Open

Windows crashing issue #1388

krll-kov opened this issue Sep 27, 2024 · 1 comment
Assignees

Comments

@krll-kov
Copy link

krll-kov commented Sep 27, 2024

Old windows 10 machines encounter crashing issues related to plugin implementation (even when plugin is not used on this platform).

I have a cross-platform app with Android and Windows support, i added flutter-permission-handler plugin to my android app and do not even use it's code on windows, hover, upon app's launch it crashes with this error (can be only seen with Visual Studio, if app is launched without visualstudio, it just instantly closes when it's launched):

image
image
image
image
image
image
image
image

image
image
image

winrt::hresult_class_not_registered, [[noreturn]] inline WINRT_IMPL_NOINLINE void throw_hresult(hresult const result)

@krll-kov
Copy link
Author

krll-kov commented Sep 27, 2024

Suggested fix (add try case wrapper), i tested and it helped:
image
image

PermissionHandlerWindowsPlugin::PermissionHandlerWindowsPlugin(){
  try {
    m_positionChangedRevoker = geolocator.PositionChanged(winrt::auto_revoke,
      [this](Geolocator const& geolocator, PositionChangedEventArgs e)
      {
      });
  } catch (...) {
    /* Do nothing */
  }
}
void PermissionHandlerWindowsPluginRegisterWithRegistrar(
    FlutterDesktopPluginRegistrarRef registrar) {
  try {
    PermissionHandlerWindowsPlugin::RegisterWithRegistrar(
        PluginRegistrarManager::GetInstance()
            ->GetRegistrar<PluginRegistrarWindows>(registrar));
  } catch (...) {
    /* Do nothing */
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants