Skip to content
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

Fixed mono from gc handle #62071

Closed
wants to merge 4 commits into from
Closed

Conversation

srxqds
Copy link
Contributor

@srxqds srxqds commented Nov 26, 2021

fix: #62052

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Nov 26, 2021
@dnfadmin
Copy link

dnfadmin commented Nov 26, 2021

CLA assistant check
All CLA requirements met.

@@ -3714,24 +3714,25 @@ mono_get_delegate_end_invoke_checked (MonoClass *klass, MonoError *error)
MonoObject*
mono_runtime_delegate_invoke (MonoObject *delegate, void **params, MonoObject **exc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all changes of mono_runtime_delegate_invoke from this PR, this is duplicate change of #62003.

@@ -12,6 +12,7 @@

namespace System.Runtime.Loader
{
[StructLayout(LayoutKind.Sequential)]
Copy link
Member

@lateralusX lateralusX Nov 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this construction is a little problematic and you see the symptoms of it. Just adding LayoutKind.Sequential might fix it, but depending on sequential field order in a partial class that is in this case not even sealed, so don't know what guarantees that will give you of complete class layout. You can also see that CoreCLR depends on a different order, that is not inline with how the fields are declared, but how they are layed out by loader. I believe a better way to fix it is to get rid of MonoManagedAssemblyLoadContext and fix mono_alc_from_gchandle to use a cached offset to the nativeAssemblyLoadContext field and then access it based on the offset instead of depending on field order in the class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thank you, i will try later

@srxqds srxqds closed this Nov 26, 2021
@srxqds srxqds deleted the fixed-mono_from_gc_handle branch November 26, 2021 14:38
@ghost ghost locked as resolved and limited conversation to collaborators Jan 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mono][bug] mono_alc_from_gchandle return wrong value?
3 participants