Skip to content

[wasm][coreclr] Fix tpa list population in corerun.html - #126021

Merged
radekdoulik merged 1 commit into
dotnet:mainfrom
radekdoulik:corerun-fix-tpa-list
Mar 24, 2026
Merged

radekdoulik merged 1 commit into
dotnet:mainfrom
radekdoulik:corerun-fix-tpa-list

Conversation

@radekdoulik

Copy link
Copy Markdown
Member

Note

This PR description was AI/Copilot-generated.

Summary

Fixes the TPA list population in the WASM corerun.html preRun callback.

Emscripten's addOnPreRun uses unshift(), so the runWithFS callback that loads preloaded file data may run before our preRun callback. The previous code unconditionally added a run dependency and waited for file preloads, but by that time the FS was already populated and the dependency monitor never triggered correctly.

The fix checks if the virtual FS is already populated when preRun executes. If data is already loaded, the TPA list is built immediately. Otherwise it falls back to the dependency monitoring approach.

The preRun callback now checks if Emscripten's runWithFS has already
populated the virtual FS before adding a run dependency. When data is
already loaded (due to addOnPreRun using unshift()), the TPA list is
built immediately. Otherwise falls back to monitoring dependencies.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings March 24, 2026 10:36
@radekdoulik radekdoulik added this to the Future milestone Mar 24, 2026
@radekdoulik radekdoulik added arch-wasm WebAssembly architecture area-Infrastructure-coreclr Only use for closed issues labels Mar 24, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes initialization ordering in the WASM corerun.html preRun callback so the APP_ASSEMBLIES (TPA list) is populated correctly even when Emscripten’s preload runWithFS callback executes before the custom preRun.

Changes:

  • Refactors TPA list creation into a helper (buildTpaList()).
  • Builds the TPA list immediately if the virtual FS appears populated; otherwise delays startup via a run dependency and waits for preload dependencies to resolve.

@radekdoulik
radekdoulik requested a review from adamperlin March 24, 2026 10:43

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

/cc @adamperlin

@radekdoulik

Copy link
Copy Markdown
Member Author

/ba-g unrelated timeouts

@radekdoulik
radekdoulik enabled auto-merge (squash) March 24, 2026 16:03
@radekdoulik
radekdoulik merged commit 2f18157 into dotnet:main Mar 24, 2026
111 of 122 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-Infrastructure-coreclr Only use for closed issues

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants