Giter Club home page Giter Club logo

Comments (24)

Bl4d3s avatar Bl4d3s commented on August 25, 2024 10

We experience the same issue with iOS 18 Beta 2 as well (was working on Beta 1).

A workaround is to set the base url using reflecting as first action in the MauiProgram.cs

var handlerType = typeof(BlazorWebViewHandler);
var field = handlerType.GetField("AppOriginUri", BindingFlags.Static | BindingFlags.NonPublic) ?? throw new Exception("AppOriginUri field not found");
field.SetValue(null, new Uri("app://localhost/"));

Then the app works like before, so I can confirm the above workaround works with Maui Blazor as well.

from maui.

jfversluis avatar jfversluis commented on August 25, 2024 5

FYI @Eilon @mkArtakMSFT we probably want to fix this before Sept!

from maui.

Eilon avatar Eilon commented on August 25, 2024 5

Thank you again to everyone for the reports, investigations, and the tip on how to fix it! The PR was merged so this will be available in the next .NET MAUI 8 service release, and also will be ported to the .NET MAUI 9 branches.

As an aside, if anyone can find docs from Apple on this change of behavior I'd love to learn more. I couldn't find any release notes or info from Apple about changes to the iOS/MacCatalyst WebView that are relevant to this (I found other notes, but nothing about this). We'd love to catch these types of things by reading release notes as opposed to finding out after it's already not working.

from maui.

github-actions avatar github-actions commented on August 25, 2024 3

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!

Closed similar issues:

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

from maui.

veler avatar veler commented on August 25, 2024 3

Thanks @Eilon ! For what it worth, on MacOs at least, I released an update of DevToys with my own fix and so far, customers are happy.

from maui.

Eilon avatar Eilon commented on August 25, 2024 2

image

from maui.

Yu-Core avatar Yu-Core commented on August 25, 2024 2

I saw this article, maybe it's helpful

https://www.oligo.security/blog/0-0-0-0-day-exploiting-localhost-apis-from-the-browser

WebKit/WebKit#29592

from maui.

Eilon avatar Eilon commented on August 25, 2024 2

I saw this article, maybe it's helpful

https://www.oligo.security/blog/0-0-0-0-day-exploiting-localhost-apis-from-the-browser

WebKit/WebKit#29592

Wow fascinating! Perhaps we should do an even broader fix for the next patch because it sounds like maybe this could affect all platforms in the future?

from maui.

Bl4d3s avatar Bl4d3s commented on August 25, 2024 1

While investigating further, we noticed some strange behavior when fetching data via JavaScript.
These requests do not seem to work.

One possible cause could be that the check in the following method now is never true, as we cannot change the const BlazorWebView.AppHostAddress which is used.

To my understanding this check, redirects the request back to the app basically.

WebView Check

Thus, the proposed workaround is not really working anymore :/
@jfversluis A fix is now strictly required imho.

We tested with localhost on both iOS 17 and 18 devices, and besides the above issue had no other problems.

from maui.

Eilon avatar Eilon commented on August 25, 2024 1

Alright I'm like this --> <-- close to getting macOS 15 Beta installed on my Mac. Thank you for all the investigations and feedback. Hopefully this is an easy fix!

from maui.

Eilon avatar Eilon commented on August 25, 2024 1

Alright all it took was getting a different Mac and downloading 40GB of updates 😁 But I can repro this on my Mac on iOS 18 Simulator - the BlazorWebView just doesn't show up at all.

I'll confirm that the suggested workaround works as a start.

But then we'll need to make sure we have a solution that works on both iOS 17 and older, but also iOS 18 and newer, and the respective MacCatalyst versions (for running on macOS desktop).

from maui.

Eilon avatar Eilon commented on August 25, 2024 1

I've got a PR here that I think should fix the issue: #23906

from maui.

Eilon avatar Eilon commented on August 25, 2024 1

@Eilon even after updating to maui 8.0.80 my Blazor hybrid app still experiences this problem. iPhone with iOS 18.0 beta 5 still shows empty screen

Hmm I checked that release and it seems to have the fix in it.

Some questions/ideas:

  1. Did you accidentally also set the AppSwitch? It must not be set - it's only there to undo the patch in case it breaks someone.
  2. Did you try on physical iOS device, or Simulator, or both? If not both, can you try on both?
  3. Can your app run on macOS/MacCatalyst? If so, does the issue happen there?
  4. Can you try uninstalling and re-installing the app on the device?
  5. Did you do a git clean -xdf (delete all untracked files in your repo - or whatever equivalent command), and then do a clean build after upgrading the package?

Hopefully we can figure this out!

from maui.

Kebechet avatar Kebechet commented on August 25, 2024 1

image
This was the only change I did. And the release was done through github actions, so no old artifacts should be in the new build.
But after running the pipeline 2nd time, uninstalling the old version and installing the new one it finally works.

Thanks you for your help!

from maui.

Eilon avatar Eilon commented on August 25, 2024 1

image This was the only change I did. And the release was done through github actions, so no old artifacts should be in the new build. But after running the pipeline 2nd time, uninstalling the old version and installing the new one it finally works.

Thanks you for your help!

Thanks for confirming you got it working! That's definitely odd.

@Kebechet if you or anyone else sees this again please let me know!

If you do still have the 'broken' IPK (or whatever file it was), it could be interesting to look inside it to see which DLLs made it into the package and see what version they are stamped with.

from maui.

Eilon avatar Eilon commented on August 25, 2024 1

I am also having this same error on my maui/blazor hybrid app. It sounds like the maui worklaod 8.0.80 may have the correct fix. However, my system is not updating past: maui 8.0.61/8.0.100 SDK 8.0.300 I am running macOS. Is there troubleshooting around how to update to this 8.0.80 version?

@sdonoghue76 can you try manually updating the reference in your app's CSPROJ file from:

        <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)" />

To:

        <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.80" />

And see if that updates the version in the app?

from maui.

sdonoghue76 avatar sdonoghue76 commented on August 25, 2024 1

I am also having this same error on my maui/blazor hybrid app. It sounds like the maui worklaod 8.0.80 may have the correct fix. However, my system is not updating past: maui 8.0.61/8.0.100 SDK 8.0.300 I am running macOS. Is there troubleshooting around how to update to this 8.0.80 version?

@sdonoghue76 can you try manually updating the reference in your app's CSPROJ file from:

        <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)" />

To:

        <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.80" />

And see if that updates the version in the app?

Thank you @Eilon .
That app is now running correctly on iOS 18 with this change.
I can just revert back to $(MauiVersion) parameters when 8.0.80 workload is associated.

Thanks again.

from maui.

veler avatar veler commented on August 25, 2024

Further Investigation

Continuing my investigation on DevToys side, I found that StartUrlSchemeTask is never invoked.

A Potential Solution for DevToys and .NET MAUI

After some time, I kind of dumbly decided to change the app host address from 0.0.0.0 to localhost, "just in case", and it worked!

image

I suspect a fix for MAUI is similar. Please try changing this line to app://localhost/ to see if it works.

https://github.com/dotnet/maui/blob/2a9f9fd1980d521d1a36f72febc5ad9f94dc706e/src/BlazorWebView/src/Maui/iOS/BlazorWebViewHandler.iOS.cs#L26C3-L26C83

Consideration

Now I'm concerned with the retro compatibility with older MacOS version. I will try getting out of MacOS 15 Beta and test on MacOS 14.

While my problem is fixed, .NET MAUI Blazor Hybrid still doesn't work at all on MacOS 15, so I will leave this issue open for now and will let you decide what to do with it :-)

from maui.

marcusbooyah avatar marcusbooyah commented on August 25, 2024

I am seeing the same using MAUI blazor on iOS 18 beta 2 as well.

from maui.

nor0x avatar nor0x commented on August 25, 2024

can confirm that this is also an issue on iOS 18 Beta 2
image

I will test the workaround now

from maui.

MarkWalter94 avatar MarkWalter94 commented on August 25, 2024

We experience the same issue with iOS 18 Beta 2 as well (was working on Beta 1).

A workaround is to set the base url using reflecting as first action in the MauiProgram.cs

var handlerType = typeof(BlazorWebViewHandler);
var field = handlerType.GetField("AppOriginUri", BindingFlags.Static | BindingFlags.NonPublic) ?? throw new Exception("AppOriginUri field not found");
field.SetValue(null, new Uri("app://localhost/"));

Then the app works like before, so I can confirm the above workaround works with Maui Blazor as well.

Workaround works on macos 15 sequoia maui blazor hybrid, saved my life, i was going to format the mac and revert to sonoma

from maui.

Nijnhoofd avatar Nijnhoofd commented on August 25, 2024

Hello there,

I'm experiencing the same of behaviour in my NET8.0-iOS app running on iOS 18.3 Beta. The app crashes on launch while showing the splashscreen. In the stacktrace of the crash no leads are to be found. Did someone experience the same thing? The solution described above isn't applicable for my app unfortunately.

from maui.

Kebechet avatar Kebechet commented on August 25, 2024

@Eilon even after updating to maui 8.0.80 my Blazor hybrid app still experiences this problem.
iPhone with iOS 18.0 beta 5 still shows empty screen

from maui.

sdonoghue76 avatar sdonoghue76 commented on August 25, 2024

I am also having this same error on my maui/blazor hybrid app. It sounds like the maui worklaod 8.0.80 may have the correct fix. However, my system is not updating past: maui 8.0.61/8.0.100 SDK 8.0.300
I am running macOS.
Is there troubleshooting around how to update to this 8.0.80 version?

from maui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.