Repository navigation
Conversation
This was referenced Oct 29, 2026
sholden
force-pushed
the
fix/extension-scan-retry
branch
from
October 29, 2026 15:20
893dfd0 to
7f0cbde
Compare
sholden
force-pushed
the
fix/path-loaded-assembly-dependencies
branch
from
October 29, 2026 15:20
0efc2da to
3edee86
Compare
sholden
force-pushed
the
fix/extension-scan-retry
branch
from
October 29, 2026 15:34
7f0cbde to
8f130a0
Compare
sholden
force-pushed
the
fix/path-loaded-assembly-dependencies
branch
from
October 29, 2026 15:34
3edee86 to
81bb8e7
Compare
Reading an assembly's extension methods loads the types in their signatures, and fails if one lives in an assembly that can't be found. RubyContext recorded the assembly as handled before reading it, and kept the record when reading failed, so nothing ever tried again: using_clr_extensions Demo require '/x/Demo2.dll' # LoadError: Demo can't be found require '/y/Demo.dll' require '/x/Demo2.dll' # true, but Demo2's extension methods never read The failed require left Demo2 out of $LOADED_FEATURES, as it should, but the retry found the runtime had seen the assembly. The DLR's ScriptDomainManager reports an assembly once, and RubyContext skipped it. A DLL required before any extension methods were asked for was only queued, and its require succeeded. The first using_clr_extensions or `using' read the queue, raised the reading error from that line, whatever its namespace, and had already emptied the queue: every assembly after the bad one lost its extension methods for good. Now an assembly whose extension methods can't be read is forgotten, so the next attempt reads it again. A require of a DLL the runtime has seen asks the context for any reading still owed, so the retry above reads Demo2's extension methods and returns true. Reading the queue, or the assemblies of a namespace being activated, warns about an assembly it can't read and goes on with the rest: warning: extension methods of Demo2 not read: Could not load file or assembly 'Demo, Version=1.0.0.0, ...' That assembly is read again at the next activation of its namespace or require of it. The constant version is bumped even when reading fails, as the assembly's namespaces are loaded either way. Require_UnreadableExtensions1 retries a require that failed, and Require_UnreadableExtensions2 queues an unreadable DLL ahead of a good one and activates their namespace twice. Both fail without the change. The fixture writer can now name the extension method. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sholden
force-pushed
the
fix/path-loaded-assembly-dependencies
branch
from
October 29, 2026 16:13
81bb8e7 to
98ed7d2
Compare
sholden
force-pushed
the
fix/extension-scan-retry
branch
from
October 29, 2026 16:13
8f130a0 to
94388b3
Compare
This was referenced Oct 29, 2026
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.
A DLL whose extension methods couldn't be read stayed that way for the rest of the process. #10 lists this under "Found, not fixed".
A worse variant shows up when the DLL is required before any extension methods are asked for. That
requireonly queues the DLL and succeeds. The firstusing_clr_extensionsorusingreads the queue and raises from that line, whatever namespace it names:Every assembly queued after Demo2 also lost its extension methods for good. master has both problems. #10 makes them rarer, because a DLL now fails this way only when nothing satisfies its reference. It still happens when a dependency is really missing.
Cause
Reading an assembly's extension methods loads the types in their signatures, so it fails when one of them lives in an assembly that can't be found.
RubyContext.AddExtensionAssemblyrecords an assembly as handled before reading it, and kept the record when reading failed.On a retried
require, the DLR'sScriptDomainManager.LoadAssemblydoesn't report an assembly it has already seen. Even if it did,RubyContextwould have skipped the assembly as handled. For the queue,RubyContextempties the queue before reading it, and one exception ended the loop.What changed
requireloads a DLL the runtime has already seen, it asks the context for any reading still owed. The retry above reads Demo2's extension methods and returnstrue.usingline no longer raises. The warning names the DLL and what's missing:usingof its namespace or the nextrequireof it.requirewhose extension methods can't be read still raisesLoadError, as before. Only theusingpath changed from raising to warning. Raising there broke ausingof an unrelated namespace, and the queue was already lost by then.The DLL itself can't be unloaded, so after a failed
requireits namespaces stay visible. That was already the case.Tests
Require_UnreadableExtensions1makes arequirefail, loads the missing dependency, and retries. The retry returnstrueand the extension method works.Require_UnreadableExtensions2queues an unreadable DLL ahead of a good one, then activates their namespace. It expects one warning, the good DLL's method working, and a second warning, not an exception, when the namespace is activated again.shout, and the second raisesFileNotFoundExceptionfrom the activation.Results:
spec/languagepasses with 2935 examples and 0 failures. TheKernel#require,require_relative,loadandautoloadspecs give 213 examples, 0 failures and the same 2 pre-existing errors as DLLs required by path find the DLLs they reference, loaded or alongside #10 lists.requirenow matches a run where it never failed, andusing System::Linqafter an unreadable Demo2 warns instead of raising, through bothusingandusing_clr_extensions. req3.rb, req4.rb and later.rb print what they did under DLLs required by path find the DLLs they reference, loaded or alongside #10.ActivateExtensionsrather thanLoadExtensions, and git placed the hunk there. I built that in a scratch worktree against a DLR with all ofBuild/dlr-patches, 0102 included, and IronRuby.Tests passes with 0 failures, the two new tests included. I removed the worktree afterwards.CI passed all seven checks. IronRuby.Tests reported 0 failure lines on ubuntu and windows with both net8.0 and net10.0, and
spec/languagepassed with 2935 examples and 0 failures on both.Stack
using_clr_extensionsusing System::Linq: CLR extension methods scoped like C#'s using directive #3 scopes CLR extension methods withusingLoader.LoadFromPathit changes and for the test fixtures. With DLLs required by path find the DLLs they reference, loaded or alongside #10's commit it also applies to master.🤖 Generated with Claude Code