Skip to content

Pass TPA through host-runtime contract instead of property string - #132861

Draft
elinor-fung wants to merge 13 commits into
dotnet:mainfrom
elinor-fung:host-contract-tpa
Draft

Pass TPA through host-runtime contract instead of property string#132861
elinor-fung wants to merge 13 commits into
dotnet:mainfrom
elinor-fung:host-contract-tpa

Conversation

@elinor-fung

@elinor-fung elinor-fung commented Aug 27, 2026

Copy link
Copy Markdown
Member

Pass trusted platform assemblies from the host to the runtime through host_runtime_contract callbacks instead of as a large string with path separators.

The host provides the resolved assembly names during initialization and the runtime requests each resolved path when needed. This reduces unnecessary parsing, reduces the amount we allocate as part of startup, and allows running applications with paths including a path separator.

The TRUSTED_PLATFORM_ASSEMBLIES property can still be explicitly queried (reconstructed on demand) and can still be explicitly supplied by custom hosts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e234f49e-502f-4c6e-bacd-0971bb2033e7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e234f49e-502f-4c6e-bacd-0971bb2033e7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e234f49e-502f-4c6e-bacd-0971bb2033e7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e234f49e-502f-4c6e-bacd-0971bb2033e7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e234f49e-502f-4c6e-bacd-0971bb2033e7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e234f49e-502f-4c6e-bacd-0971bb2033e7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e234f49e-502f-4c6e-bacd-0971bb2033e7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 11aa1554-f420-4cb0-91cb-1bba7ec51725
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

HRESULT pathResult = S_OK;
IF_FAIL_GO(pathResult = GetNextTPAPath(sTrustedPlatformAssemblies, i, /*dllOnly*/ false, fileName, simpleName));
if (pathResult == S_FALSE)
for (size_t i = 0; i < assemblyCount; i++)

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.

Would it save even more memory allocations and copying if we stopped building the hashtable here and asked the host to resolve the assembly name to a filepath on demand every time?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call. But maybe still keep the names only? The runtime does a case-insensitive hash for the names, which I don't know that we want to make any host's responsibility.

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.

Sounds reasonable

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants