Skip to content

Override type load limit in AssemblyBinder::GetNameForDiagnosticsFromManagedALC #116900

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

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Jun 22, 2025

GetNameForDiagnosticsFromManagedALC calls into user code that can trigger more type loading as side-effect.

…ManagedALC

GetNameForDiagnosticsFromManagedALC calls into user code that can trigger more type loading as side-effect.
@Copilot Copilot AI review requested due to automatic review settings June 22, 2025 05:30
Copy link
Contributor

@Copilot 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 introduces an override for the type load limit in AssemblyBinder::GetNameForDiagnosticsFromManagedALC to mitigate potential side effects from user code that can trigger additional type loading.

  • Introduces a call to OVERRIDE_TYPE_LOAD_LEVEL_LIMIT with CLASS_LOADED as an argument.
  • Ensures that user code execution is safely constrained by overriding the type load limit.
Comments suppressed due to low confidence (1)

src/coreclr/vm/assemblybinder.cpp:177

  • [nitpick] Consider adding a clarifying comment explaining why OVERRIDE_TYPE_LOAD_LEVEL_LIMIT is applied here, to improve code maintainability and clarify its purpose in mitigating side-effects from invoking user code.
    OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(CLASS_LOADED);

Copy link
Contributor

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

@jkotas
Copy link
Member Author

jkotas commented Jun 22, 2025

Found while testing #116354. It manifests as type load lever contract violation when turning tracing on and off a lot.

@jkotas jkotas merged commit 5c95e6e into dotnet:main Jun 23, 2025
97 checks passed
@jkotas jkotas deleted the typeloaderlimit branch June 23, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants