Open steveharter opened 2 years ago
Tagging subscribers to this area: @vitek-karas, @agocke, @vsadov See info in area-owners.md if you want to be subscribed.
Author: | steveharter |
---|---|
Assignees: | - |
Labels: | `disabled-test`, `area-AssemblyLoader-coreclr` |
Milestone: | - |
Description
The PR https://github.com/dotnet/runtime/pull/67917 caused the following tests to the tests to fail due to differences between the current Native-based Invoke and the new Emit-based Invoke:
It appears extra load event(s) are occurring in some cases such as for a referenced assembly ("AssemblyToLoad_Subdirectory") when using the Emit-based Invoke. These are all believed to be natural managed behavior that differs from the native behavior that doesn't require assembly dependencies to be loaded early.
Reproduction Steps
Force IL.Emit to be used:
Add the define
#define USE_EMIT_INVOKE
to the top of both files:src/libraries/System.Private.CoreLib/src/System/Reflection/ConstructorInvoker.cs
and andsrc/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs
Compile the runtime with that. Also verify with a
checked\debug
build in addition to`release
build since there appears to be differences.To run the test on Windows:
Useful shortcut example for debugging purposes:
The CI output from the PR above:
Expected behavior
The test updated to support both Emit and Native modes.
It is also possible we add support to force the invoke call to either go to Emit or Native deterministically and the test split into two to handle each case, such as by using
BindingFlags
options.Actual behavior
See the Repro steps; the test fails when Invoke uses the IL Emit path.
Regression?
Yes; as mentioned this occurs in the PR above. Note if the test was written to not use reflection, it would have worked as-is. The test appears to be influenced by the managed\Emit path.
Known Workarounds
No response
Configuration
No response
Other information
No response