Skip to content

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

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

[wasm][coreclr] Fix tpa list population in corerun.html#126021
radekdoulik merged 1 commit intodotnet:mainfrom
radekdoulik:corerun-fix-tpa-list

Conversation

@radekdoulik
Copy link
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 <223556219+Copilot@users.noreply.github.com>
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
@dotnet-policy-service
Copy link
Contributor

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

Copy link
Contributor

Copilot AI left a comment

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
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

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
Member Author

/ba-g unrelated timeouts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants