Skip to content

feat(core, site):Add AOT support and GitHub alerts in Markdown.#263

Merged
LittleLittleCloud merged 18 commits intoRazorConsole:mainfrom
TeseySTD:feat/aot
Dec 26, 2025
Merged

feat(core, site):Add AOT support and GitHub alerts in Markdown.#263
LittleLittleCloud merged 18 commits intoRazorConsole:mainfrom
TeseySTD:feat/aot

Conversation

@TeseySTD
Copy link
Member

@TeseySTD TeseySTD commented Dec 22, 2025

Key changes

  1. AOT Annotations (RazorConsole.Core):
    Added [DynamicallyAccessedMembers] attributes to AppHost, to ensure the AOT compiler preserves necessary metadata for reflection.

  2. Safe Reflection in ComponentMarkupUtilities:
    Refactored ResolveSpinner method. Replaced unsafe reflection (which was prone to trimming) with a safer approach using [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] on the target type. This ensures spinner styles are correctly resolved at runtime in AOT builds.

  3. Blazor Router & Trimming Fix:
    Problem: Standard trimming was removing Page components because they are not directly referenced (only via reflection in the Router), causing 404 errors on startup.

    • Solution (Local): Updated Directory.Build.props to include <TrimmerRootAssembly Include="$(AssemblyName)" /> for all Executable projects. This prevents aggressive trimming of the application assembly itself.
    • Solution (NuGet): Added a custom .targets file (RazorConsole.Core.targets) that is automatically included in the NuGet package. It applies the same anti-trimming protection for any user application that references RazorConsole.Core, ensuring routing works out-of-the-box.

Test

I tested it on WSL Ubuntu on RazorConsole.Gallery - everything was right, routing worked and all components too.

Closes #262.

@TeseySTD TeseySTD added the enhancement New feature or request label Dec 22, 2025
@github-actions
Copy link

github-actions bot commented Dec 22, 2025

🚀 Preview Deployment

A preview build has been generated for this PR from CI run #20511091274!

Download the artifact:
website-preview-263-5a1c3682f6678c836ac28b0ac7d3b24ff1d03de6

To view the preview locally:

  1. Download the artifact from the CI workflow run
  2. Extract the ZIP file
  3. Serve the files with a local web server
    (e.g., npx serve dist)

🌐 Live Preview URL: https://af34612d.razorconsole.pages.dev

The live preview will be automatically updated when you push new
commits to this PR.

Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
ParadiseFallen
ParadiseFallen previously approved these changes Dec 23, 2025
@TeseySTD TeseySTD changed the title feat(core):Enable Native AOT support feat(core, site):Add AOT support and GitHub alerts in Markdown. Dec 23, 2025
@TeseySTD
Copy link
Member Author

@LittleLittleCloud
I think it is ready to be merged.

@LittleLittleCloud LittleLittleCloud merged commit 7c4c625 into RazorConsole:main Dec 26, 2025
7 checks passed
@github-actions github-actions bot added this to the v0.3.0 milestone Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add Native-AOT support.

3 participants