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

[BUG] Oqtane.Maui - App closes when navigating site If server is down. #3588

Open
thabaum opened this issue Dec 21, 2023 · 6 comments
Open

Comments

@thabaum
Copy link
Contributor

thabaum commented Dec 21, 2023

Issue:

App Closes Without Warning When Navigating Site in Oqtane.Maui and Server is Down

Reproduction Steps:

  1. Launch Oqtane.Server project from one instance of Visual Studio.
  2. Launch the Windows App configured and installed after deploying the application.
  3. Navigate the site successfully from Oqtane.Maui Windows 11 application.
  4. Stop the Oqtane.Server instance from running in Visual Studio.
  5. Navigate in the Oqtane.Maui Windows application while the server instance is not running (server is down).
  6. Observe that the application either errors or closes immediately with no warning message or noticed errors.

Expected Behavior:

A user should receive a clear message indicating a connection issue, such as a redirect back to the app's index.html page with an enhancement for a Maui app connectivity error message. This enhancement should allow users to reload or "retry" when they feel the connection issues may have been resolved.

Additional Notes:

This particular issue requires further consideration as it involves a website running inside the Maui app. Suggestions and testing from the community are welcome to find a solution that enables Oqtane to handle this scenario effectively out of the box.

Potentially related ASP.NET Maui Issue:
Support Global Exception Handling Mechanism for .NET MAUI: dotnet/maui#5535 and is going to possibly be part of .NET 9 release.

@sbwalker
Copy link
Member

sbwalker commented Dec 21, 2023

@thabaum this is a similar issue which happens when running Oqtane in Visual Studio on Blazor Server or WebAssembly and you navigate to the Sytem Info page and select Restart Application. Visual Studio terminates the client application immediately. However if you run the framework in a real world environment (with a proper server) the server will restart and recover and the client browser will reconnect and continue.

I would suggest that you try running the MAUI application in a real world scenario - where the client application is connecting to a proper server installation. Running in Visual Studio will have its own behavior which is not representative of real world use.

@thabaum
Copy link
Contributor Author

thabaum commented Dec 21, 2023

@sbwalker I was only running the server in Visual Studio, I was running the deployed app after build as it installs it on the system you are working on. Then you can run the app natively without visual studio. This results in a close of app if the server is down while clicking on a link.

Run with visual studio the Maui app and it will go to an error in code of the Maui app.

I will test this further with an installation of server running on IIS but I can't see it making a difference. That is the only thing not running as a production setup while testing.

I added the Maui project to the visual studio project and set the project to deploy in build configurations.
Then run a build on the app configured to work with the server project api.
Run the server project after building after each change then run the app.
Pin it to taskbar.
Run it from the pinned up Oqtane icon on my taskbar.
Click on "Deploy Solution" to update the installed desktop app after building.

Hot reload is not working here nor does it with Visual Studio for me with Oqtane. This seems to show me results good without firing up a second instance of Oqtane.

When you fire up the app it seems to have that loading blip of white which I think should be the background color of the application default theme as in black. A little bit of flicker happening loading the page from the deployed app. It would be nice to improve this launching so it is fading into the application possibly based on average initial load time? Another topic issue possibly would be nice to see smoothed out if happening in production.

I will test this with IIS server running this so it is more production.

One last thing to note here is that if the server goes down, the app does not crash. Only in the event you click on a link that is intended to go to another page in the app triggers the crash that I am aware of.

What I am hoping to test are all behaviors for scenarios such as the following:

App starts, server is down.
App starts, server is up then goes down.
App starts, server is up and restarts.
App running and internet connectivity goes down.

Also multiple Instances of App. Treated like two different browsers so you can log in many different users. Maybe this is desired, maybe not. How to make it so you stay logged in with many app windows having different pages without having to log in each time. I can see current behavior as useful for testing to be able to log in many users in from one device.

I am analyzing the behaviors of the app in all these types of scenarios first. I am shocked to see some odd render glitches more or less coming from Maui app. I am hoping these are handled somehow that makes the app less glitchy feeling from the startup. Like occasionally the logo wont appear when the app loads. Maybe a VS thing as you said coming from the server host.

@thabaum
Copy link
Contributor Author

thabaum commented Jan 6, 2024

@sbwalker Hope all has been well. I have not been working on the .NET 8 Maui project for couple weeks now as I have been wrapping my mind and time around some other things, but I did try to get an IIS instance going on my IDE to test more of a production setup.

I had issues, not sure if something with my OS, IIS or Oqtane. I want to get this process down and double check it against current documentation. I will be working in this area today in fact and test the new commits relating to administration of sites behavior while running the .NET 8 Maui Oqtane Framework project application from desktop. I wish to run tests both from IIS directly (production) and from inside Visual Studio.

I know I had it all working in the past, I just got used to localdb and simply running the application after a build. Now that I have been using the SQL Server for testing again I can more confidently set this up and troubleshoot more effectively my current environment or application issue with IIS.

Issue is trying to run the release build files copied from folder in framework to a folder dedicated to IIS (wwwroot) as I have done in the past. I ran into a server application error(s) trying to launch it in a browser (500 I believe).

I will report back by end of the day how things went using the current dev branch with these test scenarios I previously mentioned.

Thank you for taking time to understand these issues and working them out as needed.

@thabaum
Copy link
Contributor Author

thabaum commented Jan 14, 2024

production site running on IIS with SSL signed still same issue. The Maui App crashed, but I was running the app with debugging

image

I will test the app deployed next. When I shut down the server and tried to start it again 500.30 error generated the site would not startup again. I am investigating this now. I am running my version that has all the CORS edits not sure it has anything to do with it.

The app worked just like in VS IDE with loading the site, until I hit the error shown now some reason I cannot get the alias to properly get set?! when trying to run the project again.

image

Just some odd behaviors I am trying to figure out.

I deploy it to OS and run it and get the white screen of death :)
image

and the error shown in F12 dev tools:

image

@thabaum thabaum changed the title Issue: Oqtane.Maui - App closes when navigating site If server is down. Bug: Oqtane.Maui - App closes when navigating site If server is down. Jan 14, 2024
@thabaum
Copy link
Contributor Author

thabaum commented Feb 13, 2024

Error currently shown relating to the current bug once set to hybrid is similar to the other issue with serialization of parameters.

image

blazor.webview.js:1  DynamicComponent requires a non-null value for the parameter Type.
   at Microsoft.AspNetCore.Components.DynamicComponent.SetParametersAsync(ParameterView parameters)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView directAndCascadingParameters)
NotifyUnhandledException @ blazor.webview.js:1

@thabaum
Copy link
Contributor Author

thabaum commented Feb 28, 2024

FYI: The above error no longer exists in previous message relating to dynamic component parameters as I believe it was resolved in 5.02 or the upcoming 5.1 - dev branch - recently.

The ongoing issue with the unhandled exception messages unavailable in .NET Maui WebView to enhance user experience. I put an update to the issue at the top of this thread to the master thread as a known issue along with a number of relating issues.

From what I read and believe to understand Microsoft is planning to introduce a solution in .NET 9.

This does jam things up a bit when you want to go production and have all the angles covered for the UX. Moving forward without an alternative solution but to just let the app close and put up a support FAQ for this issue.

@thabaum thabaum changed the title Bug: Oqtane.Maui - App closes when navigating site If server is down. [BUG] Oqtane.Maui - App closes when navigating site If server is down. Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants