JordanMarr / ReactiveElmish.Avalonia

Static Avalonia views for Elmish programs
Other
92 stars 8 forks source link

XPlat Web issues again #32

Closed JordanMarr closed 6 months ago

JordanMarr commented 9 months ago

The xplat build failed, so I upgraded everything to net8.0 and updated to use the new ReactiveElmish.Avalonia v1.0.0.

It runs again, but now the Web project is back to being stuck at the "powered by Avalonia UI" splash page.

I did notice there is a js console error in the browser: image

Which leads to this issue: https://github.com/AvaloniaUI/Avalonia/discussions/11037

So maybe the latest template needs to be re-run to replace some of the js files. 🤷‍♂️

@daz10000 @houstonhaynes

houstonhaynes commented 9 months ago

@jamie-rower and I were just batting around strategies for getting the XPlat project into our MiniScaffold instance for our project. I'll pull the latest and play with it a bit.

houstonhaynes commented 9 months ago

I think I need to understand better where the main.js update comes into play for your template. I just read that thread and I'm more confused now than when I glanced at your screenshot.

houstonhaynes commented 9 months ago

OK - I got the same error with .NET7 on MacOS (had to run dotnet workload install twice to get it to load wasm-tools for some reason)

So I read that thread and I'm actually not sure what to do next. What does maybe the latest template needs to be re-run to replace some of the js files. mean?

houstonhaynes commented 9 months ago

So the diff between the project folder and the folder that is generated in the "bin" folder is now my latest head-scratcher...

I wish I had a cleaner way of showing this but on the left is the Avalonia project AppBundle and the right is the generated AppBundle in the bin path. Screenshot 2023-12-09 at 4 18 01 PM

JordanMarr commented 9 months ago

So I read that thread and I'm actually not sure what to do next. What does maybe the latest template needs to be re-run to replace some of the js files. mean?

I’m assuming that the .js files are generated by the Avalonia xplat template. So I’m thinking that the way forward is to update to the latest xplat template, create a new project and then copy over the .js files. (or maybe just copy them over from the Avalonia git repo)

houstonhaynes commented 9 months ago

It looks like your dep for Avalonia is sourcing from AvaloniaCI and not NuGet. Maybe that's it?

daz10000 commented 9 months ago

I was battling with this and made some progress - I had partly worked out PR, but then the whole main project went on a tear and I've been busy, so I didn't get around to cleaning it up. It's not 100% working - I ran into the problem with workloads not installing on my machine. Looks like this branch

https://github.com/daz10000/Elmish.Avalonia/tree/23/11/MNT-update_web_target

I just pushed the changes - mainly to the AppBundle folder, which are from the new template. There were some residual issues though. Somehow it was crashing during startup still. If I did AwaitTask then RunSynchronously on the main startup task, it cashes. If I don't, it gets further but the elmish loop never started up. Also for some reason, having FluentTheme in the applicaton styles broken things, so I just commented that out for now.

I also removed nuget.config file, I think because as @houstonhaynes mentions, it was sourcing from an odd place

daz10000 commented 9 months ago

Bit the bullet and did the merge - will see if I can it to build and run but the branch is at least up to date with the rest of the project. Let's see if it even builds..

It's slowly coming back to me - I ended up in a corner of hell where the wasm workload wouldn't update


Updated advertising manifest microsoft.net.sdk.macos.
Updated advertising manifest microsoft.net.workload.emscripten.net7.
Updated advertising manifest microsoft.net.workload.mono.toolchain.net6.
Updated advertising manifest microsoft.net.workload.emscripten.net6.
Updated advertising manifest microsoft.net.sdk.ios.
Updated advertising manifest microsoft.net.sdk.maui.
Updated advertising manifest microsoft.net.sdk.android.
Updated advertising manifest microsoft.net.sdk.tvos.
Updated advertising manifest microsoft.net.workload.mono.toolchain.net7.
Updated advertising manifest microsoft.net.sdk.maccatalyst.
The machine has a pending reboot. Installation will continue, but you may need to restart.
Downloading microsoft.net.sdk.ios.manifest-7.0.100.msi.x64 (16.4.7125)
Workload installation failed. Rolling back installed packs...
Workload update failed: Value cannot be null. (Parameter 's')
JordanMarr commented 9 months ago

I tried updating bundle files from the latest template, and they did change, but still same problem. https://github.com/JordanMarr/ReactiveElmish.Avalonia/tree/xplat-update

daz10000 commented 9 months ago

My branch actually starts up, but I can either get it to render and crash or not render at all. Installing new sdk - let me see if I can it working

houstonhaynes commented 9 months ago

I'm on the xplat-update branch and it runs "clean" (no console errors) but it's also just splashing the Powered by Avalonia screen - and no favicon.ico displays though I see it in the AppBundle folder.

houstonhaynes commented 9 months ago

Do we need a 'paket' for Avalonia templates? 😸

daz10000 commented 9 months ago

I have everything pulled into that branch, but the desktop app doesn't run properly - I just get an empty window and it never renders the middle part - it's just transparent. I'm still stuck on not being able to install the wasm workloads to try the web branch. Might try a different machine at this point.

Edit: interesting, the desktop version won't work without fluenttheme in App.axaml and that was part of what was breaking the web version. Edit2: neurons waking up, and remembering part of why workload won't restore - it needs to run with admin privs, but the error message gives you no idea why it's failing. It's making more progress finally.

houstonhaynes commented 9 months ago

Funny how on Mac it hard stops if you're running dotnet workload xxx without elevated privileges

daz10000 commented 9 months ago

It does stop on the PC too, brilliantly telling you

Workload update failed: Value cannot be null. (Parameter 's')

of course..

Ok, I have web version building, and also just stuck on splash screen... let me see if I can get it a little further.

daz10000 commented 9 months ago

Ah, edge is actually being helpful and giving me the console output which firefox was withholding for some reason. Now I can see exactly where startup is failing

image

daz10000 commented 9 months ago

Yes specifically, it dies trying to use AppCompositionRoot()

image

because AppCompositionRoot() assumes a main window where the singlepage application styles (basically everything except the desktop), needs a single usercontrol at the root.

image

daz10000 commented 9 months ago

And partial success.. I had to swap out a usercontrol instead of a window for the main"Window", and then the file service can't be added in because it's looking for a window. The web version works somewhat.. chart isn't drawing but all the rest of the chart controls work.

Any thoughts on how to harmonize the top level controls?

image

image

image

houstonhaynes commented 9 months ago

I don't get what you see in FF and there's some odd behavior in the re-load of the page. I get the splash page and no favicon.ico the first time - then on refresh FF mostly reloads instantly and shows the favicon and Chrome just janks (and no console output). Screenshot 2023-12-09 at 7 42 38 PM

Screenshot 2023-12-09 at 7 42 56 PM

daz10000 commented 9 months ago

It did work for me in Firefox now - it's slower, you might need to refresh cache (I opened it in an incognito window but then the main window also worked). I did have to fix some other small things - like piping the main program task to ignore rather than runsynchronously. Changes are all on the updated branch,

image

daz10000 commented 9 months ago

still broken

houstonhaynes commented 9 months ago

And I didn't see any updates on the xplat-update branch

daz10000 commented 9 months ago

sorry, have been working over here. I'll get PR updated shortly.

daz10000 commented 9 months ago

PR #33 updated.

houstonhaynes commented 9 months ago

I'm not seeing any difference - I'll come back to a fresh start in the AM.

daz10000 commented 9 months ago

I was working on a fork and just submitted a PR to the project.   The changes aren’t in the xplat-update branch.  sorry for any confusion.  Am 12/9/23 um 6:01 PM schrieb Houston Haynes @.***>: I'm not seeing any difference - I'll come back to a fresh start in the AM.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

houstonhaynes commented 9 months ago

Just wrapping up for the night.. I followed your PR and rebased on main. I'll come back to my WinOS slab in the AM and give it a fresh look.

JordanMarr commented 9 months ago

It works again! 🎉

daz10000 commented 9 months ago

There is still an issue with the graph in the web client but I’ll look tomorrow.  It works for desktop. Might be some incompatibility in the library.Am 12/9/23 um 9:09 PM schrieb Jordan Marr @.***>: It works again! 🎉

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

JordanMarr commented 9 months ago

I made a few tweaks:

houstonhaynes commented 9 months ago

Rainstorm here in the early hours - lots of thunder and lightning 🌧️ ⚡ so I'm up 😸

I'm on WinOS - latest main - web does run but lingers on the "Powered By Avalonia" screen for a moment longer than I expect. Not a deal-breaker but interesting. Maybe I just haven't run it in a while.

LiveCharts bar chart doesn't render in .Web but does in .Desktop. Haven't tried mobile yet - on device or emulated. I updated to their latest version (2.0.0-rc2) and will scout their repo for late-breaking news, if any.

image

houstonhaynes commented 9 months ago

FYI LiveCharts 2 Issue - AvaloniaXPlatExample.Web - Bar Chart does not display

houstonhaynes commented 9 months ago

Android is not so hot either - API 34 on em or 33 on physical (Galaxy Tab 5) I get a "gray screen" and

Process finished with exit code -1. after a looooooooooong launch window.

JordanMarr commented 9 months ago

I'm seeing the same on all fronts. TBF, the Android emulator is just SLOW in general. It's exactly the same on my MAUI project -- almost unusably slow. I found that using a real device is preferable. Although setting up a real iPhone is a pain.

JordanMarr commented 9 months ago

Good news: I got Android back to working again -- even the chart seems to render properly! I forgot that when I last upgraded Avalonia, Activities.fs code failed to build because override _.CustomizeAppBuilder(builder) didn't exist as a method to override, so I commented it out to fix later.

Looking at it again, I saw that they added a new AvaloniaMainActivity base class that takes a generic arg:

type MainActivity() =
    inherit AvaloniaMainActivity<App>()
houstonhaynes commented 8 months ago

Although setting up a real iPhone is a pain.

You said a MOUTHFUL. I had my early sample app running on my iPhone - which I confirmed because it's STILL THERE 😁

But now, even after setting up a fresh dev cert and doing ALL OF THE THINGS that Rider discussion threads suggest I'm still not getting a successful iOS build. It is extremely frustrating and I have too much work to do to bang my head against that right now. So at some point I'm going to come back to face this - but for the time I spent on it my money's on a regression in the latest version of Rider.

JordanMarr commented 8 months ago

Yes, it is very frustrating! It seems like every time I come back to my Xamarin turned MAUI project after a month or more, the iPhone portion fails to build. It's the most unstable, frustrating mess I've ever seen. Many times, the fix comes in the form a new Visual Studio release. So, upgrading VS has become a regular part of my MAUI development. I hate it SO much. It makes me want to never do iOS development again.

I get the impression that a lot of the issues come from the Apple side, but I don't really know.

This is why I'm so keen on the idea of creating a PWA with Fable the next time I have to develop for iOS.