Objective-C msgSend* support for pending exceptions in Release#52849
Objective-C msgSend* support for pending exceptions in Release#52849AaronRobinsonMSFT merged 19 commits intodotnet:mainfrom
Conversation
Clear any pending exception when calling a method that may return a pending exception. Rewrite PendingException test to be more direct.
Only perform check for OSX target.
elinor-fung
left a comment
There was a problem hiding this comment.
This means we are changing the logic so that no calls to overridable functions (i.e., msgSend*) in /usr/lib/libobjc.dylib will be inlinable.
This is not just disabling inlining for objc_msgSend*, but also changing the emitted IL to always check for a pending exception object. Is that intentional? I'm not seeing why that would be necessary for this.
Yes. This aligns with the current Mono contract.
Is your interpretation that only overriding a |
|
Chatted offline. If the intention is that all msgSend invokes (not just overridden ones) will actually check for a pending exceptions, we should update the API docs. Could we also add a test for this behaviour? |
SetMessageSendPendingException API.
elinor-fung
left a comment
There was a problem hiding this comment.
Thanks for the clarifications.
...ime.InteropServices/tests/System/Runtime/InteropServices/ObjectiveC/PendingExceptionTests.cs
Outdated
Show resolved
Hide resolved
...reclr/System.Private.CoreLib/src/System/Runtime/InteropServices/ObjectiveCMarshal.CoreCLR.cs
Show resolved
Hide resolved
|
I've one more commit to add but will wait to see if the current CI is green. This final commit only contains comment code so if the CI is green, I will push the commits and then merge. |
|
Issue is #52799. |
|
The failure in crossgen2 is #49365. |
|
Failures in x64 Debug are infrastructure failures. |
|
Any plans to backport this to preview5? |
|
@filipnavara No. You can workaround this issue easily by making the P/Invoke signature non-blittable. An easy way to do this would be to set |
|
I was actually more concerned about consuming the API on the Xamarin side but I supposed it can wait one more preview or I can use custom builds. |
Fixes #52737
Fixes #52962
The current logic was assuming the
NDirectMethodDescwas always fully populated when the call toMarshalingRequiredwas performed – This is not the case, comment was added. The fix here is to attempt to populate theNDirectMethodDescwhen we get to a point where it is needed.It was also determined that a fundamental bug existed in the experience since the JIT does call
MarshalingRequiredprior to the method being run which means detecting if a method is overloaded could be detected in the scenario below. This means we are changing the logic so that no calls to overridable functions (i.e.,msgSend*) in/usr/lib/libobjc.dylibwill be inlinable and will always check for a pending exception./cc @jkotas @jkoritzinsky @elinor-fung