dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.04k stars 4.68k forks source link

Cannot use Blazor 8 RC1 wasm on GitHub pages #93017

Closed AceHack closed 2 months ago

AceHack commented 12 months ago

Is there an existing issue for this?

Describe the bug

I get the following errors when hosting on GitHub pages a blazor app https://github.com/dotnet/AspNetCore.Docs/issues/30535

Expected Behavior

Blazor app to work on GitHub pages

Steps To Reproduce

Create a new blazor app Try to host it on GitHub pages

Exceptions (if any)

See https://github.com/dotnet/AspNetCore.Docs/issues/30535

.NET Version

8 RC1

Anything else?

No response

AceHack commented 12 months ago

It was this line in the csproj that caused the issue, removing it fixed it. <WasmStripILAfterAOT>true</WasmStripILAfterAOT>

guardrex commented 12 months ago

I've called this out in the article on https://github.com/dotnet/AspNetCore.Docs/pull/30542. I'll keep an 👂 open here to learn if we're just going to dissuade devs from enabling it for GH Pages or if I need to address it some other way.

mkArtakMSFT commented 12 months ago

@lewing is this a known issue that you plan to address?

@guardrex it sounds from your comment that this is expected behavior in GitHub pages. It doesn't look to be the case, so please remove the doc comment.

guardrex commented 12 months ago

Ok ... it didn't go live ... ~I'll quick shoot a PR up to just comment it out for now and remain with a 👂 open here.~

UPDATE: Per DR, I'm removing it. I'll 👂 here if it turns out that anything needs to be said later.

lewing commented 12 months ago

WasmStripILAfterAOT should be off by default, it can definitely cause issues if applications use reflection

cc @fanyang-mono

fanyang-mono commented 12 months ago

I have a PR which might fix this issue. https://github.com/dotnet/runtime/pull/90436

AceHack commented 12 months ago

My application for the test was just the default Blazor WASM template. I personally was not using reflection, but I'm guessing Blazor does a lot.

ghost commented 12 months ago

Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.

Issue Details
### Is there an existing issue for this? - [X] I have searched the existing issues ### Describe the bug I get the following errors when hosting on GitHub pages a blazor app https://github.com/dotnet/AspNetCore.Docs/issues/30535 ### Expected Behavior Blazor app to work on GitHub pages ### Steps To Reproduce Create a new blazor app Try to host it on GitHub pages ### Exceptions (if any) See https://github.com/dotnet/AspNetCore.Docs/issues/30535 ### .NET Version 8 RC1 ### Anything else? _No response_
Author: AceHack
Assignees: -
Labels: `arch-wasm`, `untriaged`, `needs-area-label`
Milestone: -
radical commented 12 months ago

https://github.com/dotnet/AspNetCore.Docs/pull/30542/ - adds a section saying that the property is not supported for github pages. I don't think property is ready for use in 8.0 at all. So, we should not be suggesting using it at all. Feel free to correct me. cc @lewing @fanyang-mono @mkArtakMSFT

guardrex commented 12 months ago

~That PR was reverted at Dan's request. He thinks this is a bug.~

Actually, hold on ... that might still be on my To Do list. Let me check.

Yes! It was reverted (section). I'm keeping an 👂 open to learn if we need to cover anything or if it's a bug that will be fixed.

fanyang-mono commented 12 months ago

dotnet/AspNetCore.Docs#30542 - adds a section saying that the property is not supported for github pages. I don't think property is ready for use in 8.0 at all. So, we should not be suggesting using it at all. Feel free to correct me. cc @lewing @fanyang-mono @mkArtakMSFT

It should be advertised as an opt-in feature for people to try out. Before shipping it to .NET8 RC1, I did test it with Blazor WASM template app and it worked. I am curious what might have caused the issue. I will look into it.

fanyang-mono commented 12 months ago

@guardrex WasmStripILAfterAOT is a complete new feature that I introduced in .NET8 RC1. It was tested on limited scenarios before shipping. Thus, we shipped it as an opt-in feature. Those two links that you listed are not related to this feature.

guardrex commented 12 months ago

My apologies ... I'm buried in work here at the moment 😅. The correct link is ...

https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-8.0#trim-net-il-after-ahead-of-time-aot-compilation

... and it is opt-in.

It seems that we need to make some remarks about enabling it. I'll be back, but it's tough to reach this at the moment. I'll get to it as soon as I can.

If you have a suggestion for remarks, you can place them here, and I'll get them into that section.

fanyang-mono commented 2 months ago

This issue should have been fixed in .NET9. @AceHack Could you try .NET9 to see if this issue still exit?

dotnet-policy-service[bot] commented 2 months ago

This issue has been marked needs-author-action and may be missing some important information.

lewing commented 2 months ago

I believe this is fixed, please reopen if not