You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Windows build does not work with latest version of Visual Studio #1534
I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
Android
iOS
Windows
Steps to reproduce
Use flutter-permission-handler in a Flutter app
Use latest version of Visual Studio (18.6.1)
Try to compile the app for Windows
Expected results
The app compiles and works fine.
Actual results
Compilation fails with the following error:
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.51.36231\include\experimental\coroutine(37,1): error C2338: static assertion failed: 'error STL1011: The /await compiler option, <experimental/coroutine>, <experimental/generator>, and <experimental/resumable> are deprecated by Microsoft and will be REMOVED SOON. They are superseded by the C++20 <coroutine> and C++23 <generator> headers. You can define _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS to suppress this error for now.' [C:\Users\marcn\pslab-app\build\windows\x64\plugins\permission_handler_windows\permission_handler_windows_plugin.vcxproj]
Code sample
Screenshots or video
Screenshot
Version
permission_handler 12.0.1
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):[√] Flutter (Channel stable, 3.44.0, on Microsoft Windows [Version 10.0.26200.8328], locale de-DE)[√] Windows Version (Windows 11 or higher, 25H2, 2009)[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 "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe") ! "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" is not executable.[√] Visual Studio - develop Windows apps (Visual Studio Community 2026 18.6.1)[√] Connected device (2 available)[√] Network resources! Doctor found issues in 2 categories.
C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\MSVC\14.51.36231\include\experimental\coroutine(37,1): error C2338: static assertion failed: 'error STL1011: The /await compiler option, <experimental/coroutine>, <experimental/generator>, and <experimental/resumable> are deprecated by Microsoft and will be REMOVED SOON. They are superseded by the C++20 <coroutine> and C++23 <generator> headers. You can define _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS to suppress this error for now.' [D:\a\picguard\picguard\build\windows\x64\plugins\permission_handler_windows\permission_handler_windows_plugin.vcxproj]
D:\a\picguard\picguard\build\windows\x64\_deps\sentry-native-src\external\breakpad\src\common\md5.cc(74,23): warning C4267: '+=': conversion from 'size_t' to 'google_breakpad::u32', possible loss of data [D:\a\picguard\picguard\build\windows\x64\_deps\sentry-native-build\external\breakpad_client.vcxproj]
Another data point, plus the precise mechanism, since the thread has two competing workarounds and only one of them addresses the cause.
Confirming this on Windows ARM64 and on GitHub-hosted CI. A Flutter app of ours builds Windows x64 and ARM64 in CI. The ARM64 job runs on windows-11-arm, whose image moved to Visual Studio 18 (cl.exe from .../Microsoft Visual Studio/18/Enterprise/VC/Tools/MSVC/14.51.36231/bin/HostARM64/ARM64, Windows SDK 10.0.26100.0), and every build now fails with:
C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\MSVC\14.51.36231\include\experimental\coroutine(37,1): error C2338: static assertion failed: 'error STL1011: The /await compiler option, <experimental/coroutine>, <experimental/generator>, and <experimental/resumable> are deprecated by Microsoft and will be REMOVED SOON. They are superseded by the C++20 <coroutine> and C++23 <generator> headers. You can define _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS to suppress this error for now.' [...\build\windows\x64\plugins\permission_handler_windows\permission_handler_windows_plugin.vcxproj]
Our x64 job still passes only because it is pinned to windows-2022 (MSVC 14.44); the same image family with VS 18 fails on x64 too, as the logs earlier in this thread show. Versions: permission_handler 11.4.0 -> permission_handler_windows 0.2.1, but 0.2.2 and main are identical in the part that matters.
Minimal repro: any Flutter Windows app that depends on permission_handler, built with VS 18 / MSVC 14.51 (flutter build windows). No plugin API call is needed — it is a compile error in the plugin target.
Why it happens — the cause is /await, not the C++ standard. C++/WinRT picks its coroutine header on one macro (strings/base_includes.h, unchanged in the pinned Microsoft.Windows.CppWinRT 2.0.210806.1 this plugin generates its headers with):
MSVC's STL defines __cpp_lib_coroutine only #ifdef __cpp_impl_coroutine (stl/inc/yvals_core.h), and /await selects the pre-standardization coroutine mode instead of the standard one — so permission_handler_windows lands in <experimental/coroutine>even though it already compiles as cxx_std_20, and MSVC 14.51 made that header a hard error.
We can show both halves of that from one build. The same app also uses audioplayers_windows, which hit the identical STL1011 for a different reason — it requests no standard of its own, so it inherited the Flutter template's cxx_std_17. Raising just that target to cxx_std_20 made its errors disappear, while permission_handler_windows_plugin kept failing at cxx_std_20. The one difference between the two targets is /await.
That is also why add_compile_definitions(_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS) in the app's windows/CMakeLists.txt "works": it silences the assertion while still compiling against a header Microsoft says is being removed. It buys time, it is not a fix. For the record, what we currently carry in our app is the same stopgap, scoped to this one target so the rest of the app keeps its standard:
Suggestion: drop /await from the plugin's own windows/CMakeLists.txt — which is exactly what #1569 does (and what #1535 did before it was closed for an unrelated CI check). The target is already cxx_std_20, so co_await in IsBluetoothServiceEnabled compiles through standard <coroutine>; the pinned CppWinRT 2.0.210806.1 already has the __cpp_lib_coroutine branch, so no nuget bump is needed. It is also the only future-proof option: current C++/WinRT replaced that fallback with a hard #error "C++/WinRT no longer supports pre-standardization coroutines. ... If you do not [use co_await], remove /await from the compiler flags.", so /await will stop working regardless of the STL macro.
For comparison, audioplayers fixed the C++17 variant of this in the plugin package itself (bluefireteam/audioplayers#2011, released in audioplayers_windows 4.4.1) rather than asking apps to patch their CMake — which is the shape of fix that lets apps just upgrade.
Activity
marcnause commentedon May 24, 2026
Removing the following line from
permission_handler_windows/windows/CMakeLists.txtmade it work for me:target_compile_options(${PLUGIN_NAME} PRIVATE /await)kjxbyz commentedon Jun 10, 2026
Same issue.
kjxbyz commentedon Jun 23, 2026
Workaround until the plugin migrates to C++20 , define the silence macro before the plugins are added in the app's
windows/CMakeLists.txt:add_compile_definitions(_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS)perf: remove `permission_handler` from linux/windows builds
fix(windows): silence the experimental-coroutine error from permissio…
agentx-icu commentedon Sep 26, 2026
Another data point, plus the precise mechanism, since the thread has two competing workarounds and only one of them addresses the cause.
Confirming this on Windows ARM64 and on GitHub-hosted CI. A Flutter app of ours builds Windows x64 and ARM64 in CI. The ARM64 job runs on
windows-11-arm, whose image moved to Visual Studio 18 (cl.exefrom.../Microsoft Visual Studio/18/Enterprise/VC/Tools/MSVC/14.51.36231/bin/HostARM64/ARM64, Windows SDK 10.0.26100.0), and every build now fails with:Our x64 job still passes only because it is pinned to
windows-2022(MSVC 14.44); the same image family with VS 18 fails on x64 too, as the logs earlier in this thread show. Versions:permission_handler11.4.0 ->permission_handler_windows0.2.1, but 0.2.2 andmainare identical in the part that matters.Minimal repro: any Flutter Windows app that depends on
permission_handler, built with VS 18 / MSVC 14.51 (flutter build windows). No plugin API call is needed — it is a compile error in the plugin target.Why it happens — the cause is
/await, not the C++ standard. C++/WinRT picks its coroutine header on one macro (strings/base_includes.h, unchanged in the pinnedMicrosoft.Windows.CppWinRT 2.0.210806.1this plugin generates its headers with):MSVC's STL defines
__cpp_lib_coroutineonly#ifdef __cpp_impl_coroutine(stl/inc/yvals_core.h), and/awaitselects the pre-standardization coroutine mode instead of the standard one — sopermission_handler_windowslands in<experimental/coroutine>even though it already compiles ascxx_std_20, and MSVC 14.51 made that header a hard error.We can show both halves of that from one build. The same app also uses
audioplayers_windows, which hit the identical STL1011 for a different reason — it requests no standard of its own, so it inherited the Flutter template'scxx_std_17. Raising just that target tocxx_std_20made its errors disappear, whilepermission_handler_windows_pluginkept failing atcxx_std_20. The one difference between the two targets is/await.That is also why
add_compile_definitions(_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS)in the app'swindows/CMakeLists.txt"works": it silences the assertion while still compiling against a header Microsoft says is being removed. It buys time, it is not a fix. For the record, what we currently carry in our app is the same stopgap, scoped to this one target so the rest of the app keeps its standard:Suggestion: drop
/awaitfrom the plugin's ownwindows/CMakeLists.txt— which is exactly what #1569 does (and what #1535 did before it was closed for an unrelated CI check). The target is alreadycxx_std_20, soco_awaitinIsBluetoothServiceEnabledcompiles through standard<coroutine>; the pinned CppWinRT 2.0.210806.1 already has the__cpp_lib_coroutinebranch, so no nuget bump is needed. It is also the only future-proof option: current C++/WinRT replaced that fallback with a hard#error "C++/WinRT no longer supports pre-standardization coroutines. ... If you do not [use co_await], remove /await from the compiler flags.", so/awaitwill stop working regardless of the STL macro.For comparison,
audioplayersfixed the C++17 variant of this in the plugin package itself (bluefireteam/audioplayers#2011, released inaudioplayers_windows4.4.1) rather than asking apps to patch their CMake — which is the shape of fix that lets apps just upgrade.Depend only on the Android permission_handler implementation
Depend only on the Android permission_handler implementation
Depend only on the Android permission_handler implementation