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

[iOS] Generate unique class name for MonoDeadLetter #89956

Merged
merged 4 commits into from
Aug 8, 2023

Conversation

steveisok
Copy link
Member

In library mode, it is possible to have multiple shared libraries (runtimes) loaded in the same process. On iOS, we have a small bit of objc to make sure we know when threads die so we can properly detach the runtime. Unfortunately, the class name we use is not unique and results in a crash when calling into a 2nd library.

This change makes the class name partially unique to avoid such a circumstance.

In library mode, it is possible to have multiple shared libraries (runtimes) loaded in the same process. We have a small bit of objc to make sure we know when threads die to we can properly detach the runtime. Unfortunately, the class name we use is not unique and results in a crash when calling into a 2nd library.

This change makes the class name partially unqiue to avoid such a circumstance.
@vargaz
Copy link
Contributor

vargaz commented Aug 3, 2023

Multiple mono runtimes can't really coexist in the same process.

@steveisok
Copy link
Member Author

Multiple mono runtimes can't really coexist in the same process.

From what we've found, as long as you enable signal chaining, it will work.

@steveisok
Copy link
Member Author

steveisok commented Aug 3, 2023

@lateralusX in testing two libraries, xcode found two instances of

@interface PlaceholderObject : NSObject

Does that need the same treatment as MonoDeadLetter?

@lateralusX
Copy link
Member

@lateralusX in testing two libraries, xcode found two instances of

@interface PlaceholderObject : NSObject

Does that need the same treatment as MonoDeadLetter?

Did you get build/package errors or runtime load errors due to that?

@steveisok
Copy link
Member Author

Did you get build/package errors or runtime load errors due to that?

No, it just says there are two and it'll be random which one you get.

@lateralusX
Copy link
Member

lateralusX commented Aug 4, 2023

No, it just says there are two and it'll be random which one you get.

But when do you get the error, when you are packing the two libraries into the same app or at runtime when you load the second library?

@steveisok
Copy link
Member Author

But when do you get the error, when you are packing the two libraries into the same app or at runtime when you load the second library?

It's right away. Must be the way obj-c manages its symbols?

@steveisok steveisok merged commit c09d381 into dotnet:main Aug 8, 2023
@steveisok steveisok deleted the unique-dl-class-name branch August 8, 2023 16:30
@ghost ghost locked as resolved and limited conversation to collaborators Sep 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants