Complete CLR interop support - #1309
Merged
Merged
Conversation
added 2 commits
July 27, 2026 18:16
ResolveTypeArg consulted DotNetTypeRegistry.ResolveFriendly before the
program's own generic parameters and class builders. That fallback scans
every assembly in the AppDomain for a bare type name, and compiled
TypeScript classes are public types in the global namespace under their
bare name, so a type argument naming a user class could bind to a
same-named type in an unrelated loaded assembly.
The emitted metadata then carried an assembly reference the compiled
program could not resolve, surfacing as
FileNotFoundException: Could not load file or assembly 'test_<guid>'
at $Program.Main()
Because it depends on which assemblies happen to be loaded, it presented
as an intermittent CI failure (GenericsTests.GenericClass_WithConstraint_Works
in compiled mode) that passed when run in isolation.
Move the scan below the generic-parameter and class arms, matching the
precedence ILCompiler.ResolveTypeArgument already uses and the rule
RegisterDotNetImportedType applies to dotnet: imports. Names still
reaching the scan are neither primitives, @DotNetType/dotnet: imports,
nor user classes, so explicit interop type arguments are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
The full test suite was attempted during development but did not finish within the local execution window; it produced no failure output before timeout.