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

firebase_auth: Incompatible with Windows on NET 9 or VS 17.12.0 #16536

Closed
1 task done
thedeukalion opened this issue Nov 13, 2024 · 44 comments · Fixed by #16840
Closed
1 task done

firebase_auth: Incompatible with Windows on NET 9 or VS 17.12.0 #16536

thedeukalion opened this issue Nov 13, 2024 · 44 comments · Fixed by #16840
Labels
platform: windows Issues / PRs which are specifically for Windows. plugin: auth type: bug Something isn't working

Comments

@thedeukalion
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

Windows

Description

I just updated to the latest Visual Studio version and this occured on Flutter 3.24.3 and then I upgraded to 3.24.4 and it was still there. Been running this on every project between tries:

Global

dart pub cache clean --force
flutter update-packages --force-upgrade

Once per project

flutter clean
flutter pub upgrade
flutter pub get

And then I tried adding a simple project with just the firebase_auth package and it simply did not work.

.NET / Visual Studio Versions

dotnet --version = 9.0.100
Visual Studio Community 2022 17.12.0

Will try to rollback to previous DOTNET / VS version to see if there's any change.

Reproducing the issue

flutter create fb_test
cd fb_test
flutter pub add firebase_auth
flutter build windows --debug

Firebase Core version

3.7.0

Flutter Version

3.24.4

Relevant Log Output

Z:\fb_test\windows\flutter\ephemeral\cpp_client_wrapper\include\flutter\encodable_value.h(199,60): error C2665: 'std::variant<std::monostate,bool,int32_t,int64_t,double,std::string,std::vector<uint8_t,std::allocator<uint8_t>>,std::vector<int32_t,std::allocator<int>>,std::vector<int64_t,std::allocator<int64_t>>,std::vector<double,std::allocator<double>>,flutter::EncodableList,flutter::EncodableMap,flutter::CustomEncodableValue,std::vector<float,std::allocator<float>>>::variant': no overloaded function could convert all the argument types [Z:\fb_test\build\windows\x64\plugins\firebase_auth\firebase_auth_plugin.vcxproj]

Flutter dependencies

Expand Flutter dependencies snippet
Dart SDK 3.5.4
Flutter SDK 3.24.4
fb_test 1.0.0+1

dependencies:
- firebase_auth 5.3.2 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]

dev dependencies:
- flutter_lints 4.0.0 [lints]
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service]

transitive dependencies:
- _flutterfire_internals 1.3.45 [collection firebase_core firebase_core_platform_interface flutter meta]
- async 2.12.0 [collection meta]
- boolean_selector 2.1.2 [source_span string_scanner]
- characters 1.3.0
- clock 1.1.2
- collection 1.18.0
- fake_async 1.3.2 [clock collection]
- firebase_auth_platform_interface 7.4.8 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 5.13.3 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web]
- firebase_core 3.7.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_core_platform_interface 5.3.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.18.1 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- leak_tracker 10.0.5 [clock collection meta path vm_service]
- leak_tracker_flutter_testing 3.0.5 [flutter leak_tracker leak_tracker_testing matcher meta]
- leak_tracker_testing 3.0.1 [leak_tracker matcher meta]
- lints 4.0.0
- matcher 0.12.16+1 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.11.1 [collection]
- meta 1.15.0
- path 1.9.1
- plugin_platform_interface 2.1.8 [meta]
- sky_engine 0.0.99
- source_span 1.10.0 [collection path term_glyph]
- stack_trace 1.12.0 [path]
- stream_channel 2.1.2 [async]
- string_scanner 1.4.0 [source_span]
- term_glyph 1.2.1
- test_api 0.7.3 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- typed_data 1.4.0 [collection]
- vector_math 2.1.4
- vm_service 14.3.1
- web 1.1.0

Additional context and comments

No response

@thedeukalion thedeukalion added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Nov 13, 2024
@thedeukalion
Copy link
Author

Rolled back my version of Visual Studio to 17.11.5 with dotnet version 8.0.403.
Except a million warnings it successfully builds.
No changes to my flutter pub deps -- --style=compact output

@guilhermeeng99
Copy link

same here

@tranhuudang
Copy link

Haven't see any attempts to fix firebase on windows. My app crash often and still has no clue why or how to fix it. I checked for new update of firebase continuously and what I see is almost like zero fix.

@SelaseKay SelaseKay added plugin: auth platform: windows Issues / PRs which are specifically for Windows. labels Nov 14, 2024
@SelaseKay
Copy link
Contributor

cc @russellwheatley

@iyyappanGitHub
Copy link

iyyappanGitHub commented Nov 15, 2024

Same Issue.
I tried lot nothing helps.

D:\WD\BusinessPersonalManager\business_personal_manager\windows\flutter\ephemeral\cpp_client_wrapper\include\flutter\encodable_value.h(199,60): error C2665: 'std::variant<std::monostate,bool,int32_t,int64_t,double,std::string,std::vector<uint8_t,std::allocator<uint8_t>>,std::vector<int32_t,std::allocator>,std::vector<int64_t,std::allocator<int64_t>>,std::vector<double,std::allocator>,flutter::EncodableList,flutter::EncodableMap,flutter::CustomEncodableValue,std::vector<float,std::allocator>>::variant': no overloaded function could convert all the argument types [D:\WD\BusinessPersonalManager\business_personal_manager\build\windows\x64\plugins\firebase_auth\firebase_auth_plugin.vcxproj]

I tried following solutions.

  1. Reinstall the VS2022
  2. Downgrade the flutter
  3. Flutter_Auth plugin tried versions from 4.16.0 to 5.3.3

@PrimeTheFirst
Copy link

Same!

@uditrugman
Copy link

same, but this also started failing on github actions when building for windows

@PrimeTheFirst
Copy link

Rolled back my version of Visual Studio to 17.11.5 with dotnet version 8.0.403. Except a million warnings it successfully builds. No changes to my flutter pub deps -- --style=compact output

How do I rollback???

@russellwheatley russellwheatley added blocked: external dependency and removed Needs Attention This issue needs maintainer attention. labels Nov 19, 2024
@russellwheatley
Copy link
Member

russellwheatley commented Nov 19, 2024

Rolled back my version of Visual Studio to 17.11.5 with dotnet version 8.0.403. Except a million warnings it successfully builds. No changes to my flutter pub deps -- --style=compact output

@thedeukalion - thank you for confirming that reverting Visual Studio/Dot not version is a way to circumvent this issue for now 🙏

@AbdelaliAmine
Copy link

i have the same problem if any one solve it, please help me

@PrimeTheFirst
Copy link

Rolled back my version of Visual Studio to 17.11.5 with dotnet version 8.0.403. Except a million warnings it successfully builds. No changes to my flutter pub deps -- --style=compact output

@thedeukalion - thank you for confirming that reverting Visual Studio/Dot not version is a way to circumvent this issue for now 🙏

Will the issue be fixed for dotnet 9?

@russellwheatley
Copy link
Member

@PrimeTheFirst - I have no idea I'm afraid. I don't have dotnet installed on my machine

@AbdelaliAmine
Copy link

@PrimeTheFirst - I have no idea I'm afraid. I don't have dotnet installed on my machine

how do you rollback to the version 17.11.5 of visual studio?

@PrimeTheFirst
Copy link

PrimeTheFirst commented Nov 19, 2024

@PrimeTheFirst - I have no idea I'm afraid. I don't have dotnet installed on my machine

I see. Is this a flutter auth issue or a visual studio issue? Any idea when it might be fixed??

@PrimeTheFirst
Copy link

@PrimeTheFirst - I have no idea I'm afraid. I don't have dotnet installed on my machine

how do you rollback to the version 17.11.5 of visual studio?

From what I understand you can only rollback if you have upgraded it from a previous version before. Otherwise Microsoft archives have 17.11.5 update download links for the exe, which isn't working for me. It just says preparing and then closes
@thedeukalion Please guide.

@dion-gionet
Copy link

On our side, we managed to workaround the issue on Github Actions with the following steps :

      # Replace Visual Studio 17.12 with 17.10 to workaround Firebase issue
      # https://github.com/firebase/flutterfire/issues/16536
      - name: Cleanup Visual Studio Installer
        continue-on-error: true
        run: |
          & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\InstallCleanup.exe"
        shell: pwsh

      # Replace Visual Studio 17.12 with 17.10 to workaround Firebase issue
      # https://github.com/firebase/flutterfire/issues/16536
      - name: Install Visual Studio 2022 Enterprise
        run: |
          Invoke-WebRequest -Uri https://aka.ms/vs/17/release.ltsc.17.10/vs_enterprise.exe -OutFile vs_enterprise.exe
          $process = Start-Process -FilePath '.\vs_enterprise.exe' -ArgumentList "--add", "Microsoft.VisualStudio.Workload.Azure", "--quiet", "--norestart", "--wait", "--includeRecommended" -Wait -PassThru
          Write-Output $process.ExitCode
          $process = Start-Process -FilePath '.\vs_enterprise.exe' -ArgumentList "--add", "Microsoft.VisualStudio.Workload.NativeDesktop", "--quiet", "--norestart", "--wait", "--includeRecommended" -Wait -PassThru
          Write-Output $process.ExitCode
        shell: pwsh

@kaansagtas
Copy link

kaansagtas commented Nov 21, 2024

I have the same error. I tried almost everything but couldn't solve it. I just couldn't downgrade the Visual Studio version because it was a new installation and there was no old version already.

@PrimeTheFirst - I have no idea I'm afraid. I don't have dotnet installed on my machine

I see. Is this a flutter auth issue or a visual studio issue? Any idea when it might be fixed??

Is there any progress?

@AvianAeternum
Copy link

:(

@iyyappanGitHub
Copy link

On our side, we managed to workaround the issue on Github Actions with the following steps :

      # Replace Visual Studio 17.12 with 17.10 to workaround Firebase issue
      # https://github.com/firebase/flutterfire/issues/16536
      - name: Cleanup Visual Studio Installer
        continue-on-error: true
        run: |
          & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\InstallCleanup.exe"
        shell: pwsh

      # Replace Visual Studio 17.12 with 17.10 to workaround Firebase issue
      # https://github.com/firebase/flutterfire/issues/16536
      - name: Install Visual Studio 2022 Enterprise
        run: |
          Invoke-WebRequest -Uri https://aka.ms/vs/17/release.ltsc.17.10/vs_enterprise.exe -OutFile vs_enterprise.exe
          $process = Start-Process -FilePath '.\vs_enterprise.exe' -ArgumentList "--add", "Microsoft.VisualStudio.Workload.Azure", "--quiet", "--norestart", "--wait", "--includeRecommended" -Wait -PassThru
          Write-Output $process.ExitCode
          $process = Start-Process -FilePath '.\vs_enterprise.exe' -ArgumentList "--add", "Microsoft.VisualStudio.Workload.NativeDesktop", "--quiet", "--norestart", "--wait", "--includeRecommended" -Wait -PassThru
          Write-Output $process.ExitCode
        shell: pwsh

Mine is Visual Studio Community Edition,
As per microsoft forum, they clearly mentioned that community edition could not be downgraded.

@PrimeTheFirst
Copy link

PrimeTheFirst commented Nov 23, 2024

Can this issue please be resolved ASAP or can we at least know if a fix is being worked upon and maybe a possible timeframe for its completion? It's affecting a lot of developers and is completely halting development.

@seungku
Copy link

seungku commented Nov 25, 2024

After Visual Studio rollback, I solve this problem. Please consider the below link for your roll back.

https://devblogs.microsoft.com/visualstudio/introducing-visual-studio-rollback/

@adricruzado
Copy link

Hey guys,

This solved the problem for me:

1- Uninstall Visual Studio.
2- Download the installer and execute from PowerShell this command to install the version 17.8:
.\visualstudiosetup.exe --channelUri https://aka.ms/vs/17/release.LTSC.17.8/channel

@richard457
Copy link

Studio

This worked for me while waiting for package solution to support latest visual studio

@PrimeTheFirst
Copy link

Hey guys,

This solved the problem for me:

1- Uninstall Visual Studio. 2- Download the installer and execute from PowerShell this command to install the version 17.8: .\visualstudiosetup.exe --channelUri https://aka.ms/vs/17/release.LTSC.17.8/channel

Thank you!!! This works.

@PrimeTheFirst
Copy link

Hey guys,

This solved the problem for me:

1- Uninstall Visual Studio. 2- Download the installer and execute from PowerShell this command to install the version 17.8: .\visualstudiosetup.exe --channelUri https://aka.ms/vs/17/release.LTSC.17.8/channel

For those getting warning LNK4099: PDB '' was not found with use this this solution

@Vlxdi
Copy link

Vlxdi commented Nov 30, 2024

FIX: Rollback your Visual Studio version from the Visual Studio installer. Uninstall.NET9 as well. Run flutter clean -> Remove-Item -Recurse -Force .\windows (optional) -> flutter run (or just rebuild the program)

@StephanTLavavej
Copy link
Contributor

I'm a maintainer of Visual Studio's C++ Standard Library implementation. This was an intentional change - we merged microsoft/STL#4713 to unconditionally implement P0608R3 "Improving variant's Converting Constructor/Assignment" (a C++20 paper) in C++17 mode too. This now matches what GCC/libstdc++ and Clang/libc++ do, and is generally a highly desirable change for variant users, although it can have source-breaking impacts as in this case.

Instead of downgrading your VS IDE, or using an older MSVC toolset within the newer IDE, the correct long-term fix is to patch encodable_value.h's usage of std::variant so that it works with P0608R3's changes.

@StephanTLavavej

This comment was marked as resolved.

@StephanTLavavej
Copy link
Contributor

I have a fix (see linked PR) if anyone affected by this issue would like to try it with VS 2022 17.12.

@Mohamed-Reda7
Copy link

Hey guys,

This solved the problem for me:

1- Uninstall Visual Studio. 2- Download the installer and execute from PowerShell this command to install the version 17.8: .\visualstudiosetup.exe --channelUri https://aka.ms/vs/17/release.LTSC.17.8/channel

Thanks, this worked for me

@gh-pap
Copy link

gh-pap commented Dec 17, 2024

Two days ago I sat down to do a small Flutter project (first in about a year). I made sure everything was up to date, including MSVS Community. I use Windows and I generated the default Flutter app and added only two lines to the pubspec, firebase_core and firebase_auth. But it wouldn't build! I've spent the last two days assuming I had a config issue. I even wiped my machine and reinstalled Windows. I only now found this issue on GitHub.

@Mohamed-Reda7 I can't thank you enough. Reverting to MSVS 17.8 completely resolved the issue.

@StephanTLavavej My MSVS version (the one that did not work) was 17.12.3, so the issue doesn't seem to be fixed in VS 2022 17.12.

I'm such a fan of Flutter, but this was such a bad experience. The default generated app doesn't work with one of the most popular plug-ins (firebase auth) for one of the most popular OSs (Windows). I'm not a professional developer, more of a hobbyist, but I'm a huge fan of Flutter and would love for this issue to be escalated and get the attention I suspect it deserves. If someone can tell me how to do that I'm happy to do the legwork.

@StephanTLavavej
Copy link
Contributor

@gh-pap This was exposed by a VS change, but it was not a VS bug, and VS isn't being patched for this. Instead, it was a flutterfire bug, and I contributed a fix which was merged 2 weeks ago - see above. I investigated and fixed this within a day of it being brought to my attention.

If you can't wait for the next release of flutterfire, you could potentially build its latest sources. Once you can pick up the fix, you should move your MSVC toolset forward and stop pinning to an older version. (As for working around it, (1) you can use the newest VS IDE while selecting an older MSVC toolset, and (2) you can use a toolset as new as 17.10, it doesn't have to be as old as 17.8. It was the 17.12 toolset that exposed the flutterfire bug.)

would love for this issue to be escalated and get the attention I suspect it deserves.

This got attention at extremely high levels within Microsoft. A Corporate Vice President/Distinguished Engineer in Windows emailed my quad boss (a CVP himself) in DevDiv about this compiler error, and it was quickly routed down to me. (I am a mere Principal SDE, maintaining MSVC's STL for 18 years.)

@gh-pap
Copy link

gh-pap commented Dec 18, 2024

Aha, I understand now. Thanks for fixing the issue! 🙏🙏🙏 I wouldn’t trust myself to install a pre-release. I’ll just remain on the older MSVC until the fix is released (then upgrade to the latest MSVC). Does anyone know which versions of firebase_core and firebase_auth (I assume both are needed) will include Stephan's fix?

@ZiyadF296
Copy link

ZiyadF296 commented Dec 18, 2024 via email

@colnaghijr
Copy link

@StephanTLavavej Just wanted to say I appreciate the quick fix.

I have no familiarity with Flutter/Firebase, though I did a quick test by patching my local Firebase_Auth source file (the one listed on .flutter-plugins, firebase_auth=...) with @StephanTLavavej fixes.

I'll just say It works on my machine™. No VS downgrades needed and I'm unblocked until an official release.

Maybe a wiser mind can point out if this is a valid workaround.

@russellwheatley
Copy link
Member

As an FYI; we had a release freeze over the Christmas holiday period, but this fix will come out in the next release early next week 🙏

@dreamerenigma

This comment has been minimized.

@SimoLP
Copy link

SimoLP commented Jan 3, 2025

As an FYI; we had a release freeze over the Christmas holiday period, but this fix will come out in the next release early next week 🙏

Hi,
I have the same issue when trying to use Firebase Auth in my flutter project for Windows.
With this release you are talking about the problem will be fixed?

@russellwheatley
Copy link
Member

@SimoLP - The release will fix this issue.

@SimoLP
Copy link

SimoLP commented Jan 3, 2025

@SimoLP - The release will fix this issue.

Approximally when will be released?

@Mandhla
Copy link

Mandhla commented Jan 3, 2025

Good day, I was facing the problem above and I applied your fix but now I am facing a different error.

LINK : fatal error LNK1181: cannot open input file 'firebase_auth.lib' [C:\flutter\examples\food_delivery\food_app\build\windows\x64\runner\food_app.vcxproj]
Building Windows application... 140.8s
Build process failed.

I don't know why the file is not being generated

@insertjokehere
Copy link

@StephanTLavavej - thanks for the fix, especially in a codebase that isn't in your primary ecosystem :)

I think this issue (and some of the frustration you've seen from others in the thread) highlights a weakness in the way the Flutter tooling interacts with MSVC. For other platforms that Flutter targets (Android especially), we can specify the exact versions of toolchain components we expect to use (Gradle, AGP, Android SDKs etc) in a way that can be committed in version control and shared with our teams (and CI runners). This does mean that we tend to be using older versions of compilers, but lets us upgrade when its convenient, and rebuild older versions without having to figure out what specific versions of components happened to be available at the time.

For Windows builds, Flutter developers don't really have a way of doing this - we are at the mercy of whatever versions of MSVC, the Windows SDK, dotnet SDKs, cmake, ... that happen to be installed at the time. I've had a couple of instances over the years of builds being broken because GitHub CI upgraded some component and it exposed an issue with a 3rd party plugin.

Are there mechanisms in the MSVC ecosystem that Flutter should be taking advantage of to alleviate this problem?

@StephanTLavavej
Copy link
Contributor

That's really a GitHub CI question (which I am unfamiliar with; I don't know what image options are available), not an MSVC question. From the MSVC installer perspective, we provide installers for released versions at stable URLs, so you can "pin" to (e.g.) 17.12 and then step forward to 17.13 when you're ready. (Annoyingly, this is not the case for preview versions; you can get the latest preview, but there's no stable URL to obtain arbitrary preview releases.)

If possible, I recommend also testing with the latest VS Preview, which will allow you to notice upcoming breaking changes (or report toolset bugs) well in advance of the production release. Typically, Preview 1 and Preview 2, and sometimes Preview 3, are the previews that contain significant toolset changes that could break code. Later Previews contain minor, individually merged bugfixes, which are very unlikely to break code. So if you're continuously validating with VS Preview in addition to the last production release, you'll have high confidence that the next production release will continue to work.

(Over in microsoft/STL, we use Azure Pipelines for our CI system, manually preparing an image each month, which allows us to pin the latest VS Preview available at that time; we happen to require the latest VS Preview and never the production release because we're special, otherwise production + preview would be appropriate for us too.)

@insertjokehere
Copy link

Apologies for derailing a closed thread, perhaps this would have been better bought up somewhere else.

we provide installers for released versions at stable URLs, so you can "pin" to (e.g.) 17.12 and then step forward to 17.13 when you're ready

Thanks - we are currently using this as a workaround in CI until this fix is released but does have a few issues:

  • I work on multiple projects - some of which get very infrequent maintenance, so the last production release might have been built with a Visual Studio release that is a year old. Having to switch back and forth between Visual Studio versions (uninstall v17.x, install v17.y) when I switch between projects is a major time overhead
  • One of the projects I work on has quite a long tail of supported version - I might need to release a hotfix for a release branch from a year ago, a 6-month-old release branch, and integrate the fix into our current mainline. Again, switching versions is an overhead, and we then need to keep our documentation and build scripts in sync to ensure that we aren't making changes that we don't intend to
  • I have a team of developers working with me - again, overhead of coordinating changes with them
  • I've also had issues that were exposed by Windows SDK changes - from what I can see there isn't a straightforward way to install specific versions of these components non-interactively

Perhaps these issues aren't major, but they aren't things we need to deal with on other platforms (although Apple is worse - we don't have an option to downgrade XCode or the iOS SDK if it breaks).

In my ideal world, I'd like to be able to include a file in git that specifies a version of Visual Studio and the versions of the optional components that are required, and be able to run a single command to configure my system to use those versions (or install them along side the other installed versions if they aren't already present).

@firebase firebase locked and limited conversation to collaborators Jan 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: windows Issues / PRs which are specifically for Windows. plugin: auth type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.