-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[mono] Assembly load failures in mono_class_is_subclass_of_internal #54816
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: Issue DetailsDescriptionUsing a Mono runtime based "dotnet" host to build the runtime libs.tests target currently fails for with an error building the System.Reflection.Metadata.ApplyUpdate test cases. The actual command that fails is the following (after the fix for #54814 is applied):
ConfigurationI'm building natively on s390x-ibm-linux, using a .NET 6 Preview5 host toolchain rebuilt for s390x from the official sources (plus some extra patches required to support s390x - these are mostly backports from mainline plus pending PRs). Note that this toolchain is based on the Mono runtime as we don't support CoreCLR on s390x. Regression?It is a regression in the sense that the libs.tests target used to build previously. But that is caused simply by the fact that the ApplyUpdates test exposing the problem was recently added. The underlying problem in the Mono loader was there previously. Other informationIt appears true that SQLitePCLRaw.core cannot be found in the current application context. However, I understand that the way the "wrapper" type is used in Microsoft.CodeAnalysis.SQLite.Interop.SafeSqliteBlobHandle is intended to allow for that case; the type is supposed to be allowed to be undefined until the wrapper is actually used. The immediate reason for the failure is the following Mono call chain:
where the is_subclass_of intrinsic is called from managed code here:
The caller simply wants to invoke This is different with the CoreCLR runtime, where IsSubtypeOf does not trigger any type resolution, and therefore this error does not occur. Looking at the history of the Mono code, it seems the call to However, that bug only refers to the interface scenario, which doesn't apply in the case where I see the problem. It seems a simple fix could therefore be to restrict the
|
* Only call mono_class_init_internal if check_interfaces is true. * Fixes dotnet/runtime#54816 Backported from dotnet/runtime#54817 Co-Authored-By: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Description
Using a Mono runtime based "dotnet" host to build the runtime libs.tests target currently fails for with an error building the System.Reflection.Metadata.ApplyUpdate test cases.
The actual command that fails is the following (after the fix for #54814 is applied):
Configuration
I'm building natively on s390x-ibm-linux, using a .NET 6 Preview5 host toolchain rebuilt for s390x from the official sources (plus some extra patches required to support s390x - these are mostly backports from mainline plus pending PRs). Note that this toolchain is based on the Mono runtime as we don't support CoreCLR on s390x.
Regression?
It is a regression in the sense that the libs.tests target used to build previously. But that is caused simply by the fact that the ApplyUpdates test exposing the problem was recently added. The underlying problem in the Mono loader was there previously.
Other information
It appears true that SQLitePCLRaw.core cannot be found in the current application context. However, I understand that the way the "wrapper" type is used in Microsoft.CodeAnalysis.SQLite.Interop.SafeSqliteBlobHandle is intended to allow for that case; the type is supposed to be allowed to be undefined until the wrapper is actually used.
The immediate reason for the failure is the following Mono call chain:
where the is_subclass_of intrinsic is called from managed code here:
The caller simply wants to invoke
IsClass
on the type (which internally checks for IsSubtypeOf the object type). In Mono,this triggers a call to
mono_class_init_internal
which wants to instantiate all the member types by loading the defining assemblies if necessary. At this point the failure occurs.This is different with the CoreCLR runtime, where IsSubtypeOf does not trigger any type resolution, and therefore this error does not occur.
Looking at the history of the Mono code, it seems the call to
mono_class_init_internal
was introduced by @vargaz here: 58255fa in order to fix https://bugzilla.xamarin.com/41/41466/bug.html .However, that bug only refers to the interface scenario, which doesn't apply in the case where I see the problem. It seems a simple fix could therefore be to restrict the
mono_class_init_internal
call to the case wherecheck_interfaces
is true. This does in fact resolve the problem I'm seeing. I'll submit a PR proposing that fix shortly.The text was updated successfully, but these errors were encountered: