-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fixed mono from gc handle #62071
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
Closed
Closed
Fixed mono from gc handle #62071
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| { | ||
| MONO_REQ_GC_UNSAFE_MODE; | ||
|
|
||
| ERROR_DECL (error); | ||
| MonoObject* result = NULL; | ||
| MONO_ENTER_GC_UNSAFE; | ||
| if (exc) { | ||
| MonoObject *result = mono_runtime_delegate_try_invoke (delegate, params, exc, error); | ||
| result = mono_runtime_delegate_try_invoke (delegate, params, exc, error); | ||
| if (*exc) { | ||
| mono_error_cleanup (error); | ||
| return NULL; | ||
| result = NULL; | ||
| } else { | ||
| if (!is_ok (error)) | ||
| *exc = (MonoObject*)mono_error_convert_to_exception (error); | ||
| return result; | ||
| } | ||
| } else { | ||
| MonoObject *result = mono_runtime_delegate_invoke_checked (delegate, params, error); | ||
| result = mono_runtime_delegate_invoke_checked (delegate, params, error); | ||
| mono_error_raise_exception_deprecated (error); /* OK to throw, external only without a good alternative */ | ||
| return result; | ||
|
|
||
| } | ||
| MONO_EXIT_GC_UNSAFE; | ||
| return result; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
MonoManagedAssemblyLoadContextand fixmono_alc_from_gchandleto 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.There was a problem hiding this comment.
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