Skip to content

Allow modification of entry assembly and probing after startup hooks are run #99883

Closed
@steveisok

Description

@steveisok

In certain custom hosting scenarios, it is desirable to prime the runtime by running a dummy application with a startup hook and then give the host the ability to change the application being run by altering its entry assembly and probing paths.

The way the custom host can achieve this is by:

Rules of note

  • We should start with only allowing System.Private.CoreLib to be loaded because once it's loaded, we cannot replace it
  • The exception to the rule is the entry assembly.
  • If the thread apartment state changes, the main thread needs updated. See Streamline Windows Forms application configuration and bootstrap designs#223 (comment)
  • It is the responsibility of the custom host to check if the new runtime config is compatible via hostfxr_initialize_for_runtime_config
    • Success_HostAlreadyInitialized: compatible
    • Success_DifferentRuntimeProperties: technically compatible, but may impact runtime behavior. Not advised to use
    • CoreHostIncompatibleConfig: incompatible

Considerations

  • For inspiration of the HOST_RUNTIME_CONTRACT structure, mono has an equivalent-ish implementation.

Metadata

Metadata

Labels

User StoryA single user-facing feature. Can be grouped under an epic.area-Host

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions