-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
NullReferenceException throws on Windows when setting Cookies on .NET MAUI WebView #24846
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
7fa653b
to
e767611
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Azure Pipelines successfully started running 3 pipeline(s). |
1 similar comment
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
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.
Apologies
By under I just meant switch the place of the call here
So change the code to be
UpdateUserAgent
webViewHandler.SyncPlatformCookies(platformWebView.CoreWebView2.Source).FireAndForget();
vs
webViewHandler.SyncPlatformCookies(platformWebView.CoreWebView2.Source).FireAndForget();
UpdateUserAgent
{ | ||
sender.UpdateUserAgent(handler.VirtualView); | ||
handler.SyncPlatformCookies(sender.CoreWebView2.Source).FireAndForget(); |
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.
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.
We've added cookie validation to the UI test as per your suggestion. Could you please verify once?
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
33d0338
to
84e03cf
Compare
/rebase |
…er platform view.
84e03cf
to
25cd0be
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Root Cause
While setting a cookie in MAUI WebView, CoreWebView2 is null before the CoreWebView2Initialized event triggered.
Description of Change
Added the null condition for CoreWebView2 property while sync platform cookie method.
Issues Fixed
Fixes #18452
Validated the behaviour in the following platforms
Output images
Before changes
After changes