-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[HybridWebView] Add WebViewInitializing and WebViewInitialized Events #29531
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tj-devel709
commented
May 15, 2025
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs
Outdated
Show resolved
Hide resolved
jsuarezruiz
previously requested changes
May 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few build errors:
C:\a\_work\1\s\src\Core\src\Handlers\HybridWebView\HybridWebViewHandler.Windows.cs(224,26): error CS0120: An object reference is required for the non-static field, method, or property 'ViewHandler<IHybridWebView, WebView2>.VirtualView' [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
C:\a\_work\1\s\src\Core\src\Handlers\HybridWebView\HybridWebViewHandler.Windows.cs(237,5): error CS0120: An object reference is required for the non-static field, method, or property 'ViewHandler<IHybridWebView, WebView2>.VirtualView' [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.7.250401001\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets(845,9): error MSB3073: The command ""C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.7.250401001\buildTransitive\..\tools\net6.0\..\net472\XamlCompiler.exe" "C:\a\_work\1\s\artifacts\obj\Core\Release\net10.0-windows10.0.19041.0\\input.json" "C:\a\_work\1\s\artifacts\obj\Core\Release\net10.0-windows10.0.19041.0\\output.json"" exited with code 1. [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
C:\a\_work\1\s\src\Core\src\Handlers\HybridWebView\HybridWebViewHandler.Windows.cs(224,26): error CS0120: An object reference is required for the non-static field, method, or property 'ViewHandler<IHybridWebView, WebView2>.VirtualView' [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-windows10.0.20348.0]
C:\a\_work\1\s\src\Core\src\Handlers\HybridWebView\HybridWebViewHandler.Windows.cs(237,5): error CS0120: An object reference is required for the non-static field, method, or property 'ViewHandler<IHybridWebView, WebView2>.VirtualView' [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-windows10.0.20348.0]
C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.7.250401001\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets(845,9): error MSB3073: The command ""C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.7.250401001\buildTransitive\..\tools\net6.0\..\net472\XamlCompiler.exe" "C:\a\_work\1\s\artifacts\obj\Core\Release\net10.0-windows10.0.20348.0\\input.json" "C:\a\_work\1\s\artifacts\obj\Core\Release\net10.0-windows10.0.20348.0\\output.json"" exited with code 1. [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-windows10.0.20348.0]
6 Error(s)
800483f to
3edb489
Compare
856502d to
0f92314
Compare
330695d to
b9f2cf3
Compare
1e99b80 to
443066e
Compare
# Conflicts: # src/Controls/src/Core/HybridWebView/HybridWebView.cs # src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt # src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt # src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt # src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt # src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt # src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt # src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt # src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs # src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt # src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt # src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt # src/Core/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt # src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt # src/Core/src/PublicAPI/net/PublicAPI.Unshipped.txt # src/Core/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt # src/Core/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt
# Conflicts: # src/Controls/tests/DeviceTests/Elements/HybridWebView/HybridWebViewTests.cs
* Initial plan * Fix documentation bug in IInitializationAwareWebView.cs Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
WebView2 does not allow different envvars and some settings in a single process simultaneously without also configuring different user data folders. Also, better to run the webview tests in series as they can confict with other things we do.
429797d to
af77aec
Compare
|
/backport to release/10.0.1xx-preview7 |
|
Started backporting to release/10.0.1xx-preview7: https://github.com/dotnet/maui/actions/runs/16754040073 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area-controls-hybridwebview
HybridWebView control
p/0
Work that we can't release without
platform/android
platform/ios
platform/windows
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
Adds initialization events to HybridWebView following the same pattern as BlazorWebView, enabling platform-specific WebView customization before and after initialization.
New Events
WebViewInitializing- Fired before WebView creation, allows configuration of platform-specific initialization parametersWebViewInitialized- Fired after WebView creation, provides access to the native WebView instance and settingsPlatform Support
Usage Example
Issues