Skip to content

Add mechanism for host to provide callback for getting assembly data #112706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
Tracked by #111770
elinor-fung opened this issue Feb 19, 2025 · 1 comment · Fixed by #113356
Closed
3 tasks done
Tracked by #111770

Add mechanism for host to provide callback for getting assembly data #112706

elinor-fung opened this issue Feb 19, 2025 · 1 comment · Fixed by #113356
Labels
area-Host in-pr There is an active PR which will close this issue when it is merged
Milestone

Comments

@elinor-fung
Copy link
Member

elinor-fung commented Feb 19, 2025

The runtime should enable a way for the host to provide the data representing an assembly. This is a similar idea to the existing bundle_probe, but with the host fully handling populating the data (as opposed to it being an offset into the current executable that the runtime then maps).

To do this, we can update the host_runtime_contract with a new callback:

// Probe for an assembly by `path`. Sets the data representing the assembly (`data`, `size`)
// Returns true if found, false otherwise.
bool(HOST_CONTRACT_CALLTYPE* external_assembly_probe)(
    const char* path,
    /*out*/ void** data
    /*out*/ int64_t* size);

This will be called before the default assembly resolution by the runtime. If both bundle_probe and external_assembly_probe are set, bundle_probe is called first.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Feb 19, 2025
Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

@elinor-fung elinor-fung added this to the 10.0.0 milestone Feb 19, 2025
@elinor-fung elinor-fung removed the untriaged New issue has not been triaged by the area owner label Feb 19, 2025
grendello added a commit to grendello/runtime that referenced this issue Feb 20, 2025
Signature is altered on Android, by adding a pointer to the host contract
structure.

The host contract structure also gains a new pointer, `external_assembly_probe`
(proposed in dotnet#112706) which is used, if
present, when `bundle_probe` is `nullptr` or if it returns `false` when called.

Either `bundle_probe` or `external_assembly_probe` must be set in the contract
steveisok pushed a commit that referenced this issue Feb 25, 2025
…data (#112705)

Add a new callback to `host_runtime_contract` that is called default assembly resolution:
```c++
// Probe the host for `path`. Sets pointer to data start and its size, if found.
// Returns true if found, false otherwise. If false, out parameter values are ignored by the runtime.
bool(HOST_CONTRACT_CALLTYPE* external_assembly_probe)(
    const char* path,
    /*out*/ void** data
    /*out*/ int64_t* size);
```

Contributes to #112706

This is a set of minimal changes required to make dotnet/android#9572 (the `.NET for Android` CoreCLR host) work with standard .NET for Android applications.
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Mar 11, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Host in-pr There is an active PR which will close this issue when it is merged
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant