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

HybridWebView: browser dev tools not working #24497

Closed
mallibone opened this issue Aug 28, 2024 · 11 comments
Closed

HybridWebView: browser dev tools not working #24497

mallibone opened this issue Aug 28, 2024 · 11 comments
Labels
area-controls-hybridwebview HybridWebView control platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Milestone

Comments

@mallibone
Copy link
Contributor

Description

I currently am experiencing an issue in a small Vue app when integrating it into the hybrid web view. According to this issue #22305 the dev tools should be enabled by default. I do not see the app popping up under the Develop Safari Menu. Did see the the app showing when using the latest MAUI Blazor Hybrid template.

Steps to Reproduce

Create a new MAUI App. Add a HybridWebView with a hello world Vue app (or basic HTML/JS provided in release notes of .NET 9 Preview 7). Check Develop Menu of Safari. No App appears under my current machine.

Link to public reproduction project repository

No response

Version with bug

9.0.0-preview.7.24407.4

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

macOS Sonoma 14.6.1

Did you find any workaround?

No

Relevant log output

No response

@mallibone mallibone added the t/bug Something isn't working label Aug 28, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@samhouts samhouts added the platform/macOS 🍏 macOS / Mac Catalyst label Aug 28, 2024
@mallibone
Copy link
Contributor Author

Seems like this is related to the answer provided in #18243

After adding the following lines to my CreateMauiApp I can inspect my app with the Safari dev tools:

#if MACCATALYST
       Microsoft.Maui.Handlers.HybridWebViewHandler.Mapper.AppendToMapping("Inspect", (handler, view) =>
	       {
		       if (OperatingSystem.IsMacCatalystVersionAtLeast(16, 4))
		       {
			       handler.PlatformView.Inspectable = true;
			       // For older versions .NET Mac Versions that don't include the Inspectable field.
			       // handler.PlatformView.SetValueForKey(Foundation.NSObject.FromObject(true), new Foundation.NSString("inspectable"));
		       }
       });
#endif

Don't know if this makes it a duplicate since one is related to WebView and my issue would still be with HybridWebView?

@drasticactions
Copy link
Contributor

#19909 I fixed this for BlazorWebView, but AFAIK, WebView, BlazorWebView, and HybridWebView are different controls with different implementations. My fix for the original one was for BlazorWebView. A similar thing would need to be done for HybridWebView.

So AFAIK this wouldn't be a dupe.

@samhouts samhouts added the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Aug 29, 2024
@PureWeen PureWeen added this to the Backlog milestone Aug 29, 2024
@PureWeen
Copy link
Member

@Eilon thoughts?

@Eilon Eilon added area-controls-hybridwebview HybridWebView control and removed area-blazor Blazor Hybrid / Desktop, BlazorWebView labels Sep 9, 2024
@Eilon
Copy link
Member

Eilon commented Sep 9, 2024

Hmm I'll have to take a look. Pretty sure I used the Safari Dev Tools the other day while debugging HybridWebView. I'll try again.

@Eilon
Copy link
Member

Eilon commented Sep 9, 2024

OK I do see the Safari Dev Tools showing up, but they're empty. So it knows it's enabled, but it doesn't show any of the contents of the web view being inspected (no elements, no requests, etc.). The code for enabling this in both BlazorWebView and HybridWebView at first glance appears to be identical... so something weird is happening.

@Eilon
Copy link
Member

Eilon commented Sep 9, 2024

OK, the code if in fact identical, except for one minor detail: in HybridWebView the code that sets up the dev tools sets everything up correctly, and then doesn't use all the configuration logic that it set up! 😜

@Eilon
Copy link
Member

Eilon commented Sep 9, 2024

Alright confirmed that the problem is PEBKAC! Fix will be submitted soon!

@Eilon Eilon modified the milestones: Backlog, 9.0-rc2 Sep 9, 2024
Eilon added a commit that referenced this issue Sep 9, 2024
The dev tools settings were being set on a separate webview that wasn't being used. This change applies the settings to the webview actually being used.

Fixes #24497
@Eilon
Copy link
Member

Eilon commented Sep 9, 2024

PR here: #24679

@mallibone thanks for the report on this! It was such a silly bug!

@mallibone
Copy link
Contributor Author

Cool - thanks for taking the time. Looking forward to using it in an upcoming .NET release 😃

jfversluis pushed a commit that referenced this issue Sep 10, 2024
The dev tools settings were being set on a separate webview that wasn't being used. This change applies the settings to the webview actually being used.

Fixes #24497
@jfversluis
Copy link
Member

Fixed by #24679

@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-hybridwebview HybridWebView control platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants