Skip to content

[plugin:file_selector] MSVC Compilation Error with /permissive- Flag #163296

@NEIL-smtg

Description

@NEIL-smtg

Steps to reproduce

Hi, I work on Microsoft Visual C++ testing, after our maintainer acknowledged firebase/flutterfire#16536 and it was being fixed in firebase/flutterfire#16840, we proceeded with further testing and building with /permissive- and /std:c++latest and encountered several compilation errors.

Note: Feel free to close this issue if /permissive- or /std:c++latest are not supported.

  1. Open x64 native tools command prompt for VS2022.
  2. set VSCMD_SKIP_SENDTELEMETRY=1 & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=amd64 & set _CL_= /permissive-
  3. git clone https://github.com/firebase/flutterfire
  4. cd firebase\flutterfire\packages\firebase_storage\firebase_storage\example
  5. flutter pub get 2>&1
  6. flutter build windows --verbose 2>&1

Expected results

Build successfully

Actual results

firebase_storage\example\windows\flutter\ephemeral\cpp_client_wrapper\include\flutter/encodable_value.h(199,60): note: the template instantiation context (the oldest one first) is
\firebase_storage\example\windows\flutter\ephemeral\.plugin_symlinks\file_selector_windows\windows\file_selector_plugin.cpp(225,39): note: see reference to function template instantiation 'flutter::EncodableValue::EncodableValue<HRESULT>(T &&) noexcept' being compiled
        with
        [
            T=HRESULT
        ]
\firebase_storage\example\windows\flutter\ephemeral\.plugin_symlinks\file_selector_windows\windows\file_selector_plugin.cpp(257,41): note: see reference to function template instantiation 'flutter::EncodableValue::EncodableValue<HRESULT>(T &&) noexcept' being compiled
        with
        [
            T=HRESULT
        ]

Code sample

Apologies for being unable to locate the source code in any repository.
This line of code can be found on file_selector_plugin.cpp(225,39) and file_selector_plugin.cpp(257,41)

if (!SUCCEEDED(dialog.last_result())) {
    return FlutterError("System error", "Could not create dialog",
                        EncodableValue(dialog.last_result()));
  }

Simply changing EncodableValue(dialog.last_result())); to flutter::CustomEncodableValue(dialog.last_result())); will resolve the compilation issue.

Screenshots or Video

Logs

/permissive- Build log: Build (1).log
/std:c++latest Build log: Build (2).log

Note: Feel free to close this issue if /permissive- or /std:c++latest are not supported.

Flutter Doctor output

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.4, on Microsoft Windows [Version 10.0.20348.3207],
    locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/windows-android-setup for detailed
      instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[X] Chrome - develop for the web (Cannot find Chrome executable at
    .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.3)
[!] Android Studio (not installed)
[√] VS Code (version 1.96.2)
[√] Connected device (2 available)
[√] Network resources

Metadata

Metadata

Labels

P2Important issues not at the top of the work listfyi-windowsFor the attention of the Windows platform teamp: file_selectorThe file_selector pluginpackageflutter/packages repository. See also p: labels.platform-windowsBuilding on or for Windows specificallyteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions