-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Runtime_90219 fails on Mono #90374
Comments
By analysing the provided CI build and reproducing locally this seems to only fail in full AOT mode. The tests passes on: <test name="JIT/Regression/JitBlue/Runtime_90219/Runtime_90219/Runtime_90219.dll" type="Runtime_90219" method="TestEntryPoint" time="0.004416" result="Pass"></test> |
The crash seems to be related to using custom A smaller repro: using System;
using System.Reflection;
using System.Runtime.Loader;
namespace HelloWorld
{
public class CustomAssemblyLoadContext : AssemblyLoadContext
{
public CustomAssemblyLoadContext(): base(true)
{
}
}
internal class Program
{
private static void Main(string[] args)
{
// This does not crash when we use AssemblyLoadContext.Default
var customAlc = new CustomAssemblyLoadContext();
Test(customAlc);
}
public static void Test(AssemblyLoadContext alc)
{
var asm = alc.LoadFromAssemblyPath(System.Reflection.Assembly.GetExecutingAssembly().Location);
var mi = asm.GetType(typeof(Program).FullName).GetMethod(nameof(MyMethod));
var pass = (bool)mi.Invoke(null, null);
if (pass)
Console.WriteLine("pass");
else
Console.WriteLine("fail");
}
public static byte TheByte = 42;
public static bool MyMethod()
{
var aByte = TheByte;
Console.WriteLine($"aByte: {aByte}");
return (int) aByte == 42;
}
}
} Running the above in full AOT mode prints:
|
@vargaz do we support loading AOT images for assemblies from non-default ALC? |
It's a collectible ALC. So it looks like we reall dont' support it. runtime/src/mono/mono/mini/aot-runtime.c Lines 1965 to 1970 in 5ef2a9b
I think that Update but on the other hand, we apparently turn all ALCs into non-collectible ALCs??
|
I think because in case MONO_AOT_TYPEREF_TYPEDEF_INDEX:
idx = decode_value (p, &p);
image = load_image (module, 0, error);
if (!image)
return NULL;
klass = mono_class_get_checked (image, MONO_TOKEN_TYPE_DEF + idx, error);
break;
case MONO_AOT_TYPEREF_TYPEDEF_INDEX_IMAGE:
idx = decode_value (p, &p);
image = load_image (module, decode_value (p, &p), error);
if (!image)
return NULL;
klass = mono_class_get_checked (image, MONO_TOKEN_TYPE_DEF + idx, error);
break; so we always end up with a reference to the |
The test being added in #90318 fails on Mono in full AOT mode:
https://dev.azure.com/dnceng-public/public/_build/results?buildId=370197&view=ms.vss-test-web.build-test-results-tab&runId=7857242&paneView=debug
The text was updated successfully, but these errors were encountered: