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

Add exception support to Reinterop #548

Merged
merged 13 commits into from
Feb 2, 2025
Merged

Add exception support to Reinterop #548

merged 13 commits into from
Feb 2, 2025

Conversation

kring
Copy link
Member

@kring kring commented Jan 24, 2025

Exceptions thrown in C# can be caught in C++, and exceptions thrown in C++ can be caught in C#. Exceptions thrown in C# can also now safely pass through C++ code to be code in other C# code, and vice-versa.

This is a big improvement because previously:

  • C# exceptions would silently pass through C++ code without calling destructors. 💥
  • C++ exceptions that escaped from the C++ code would pretty much just kill the process. 💥💥

Fixes #18
It works pretty much just as I described in this comment:
#18 (comment)

@kring
Copy link
Member Author

kring commented Jan 29, 2025

This still has a problem where constructors have an exception parameter in C# but not C++, so don't merge it yet.

@kring
Copy link
Member Author

kring commented Jan 31, 2025

Ok this should be ready to go now!

@kring kring added this to the February 2025 Release milestone Jan 31, 2025
Base automatically changed from update-native to main January 31, 2025 12:16
@azrogers azrogers self-assigned this Jan 31, 2025
@azrogers
Copy link
Contributor

The PR looks good, but seems like there's still a build error on Windows.

@azrogers
Copy link
Contributor

The build error is that openssl is failing to build on ARM64 Android. I have no idea what we could've changed to make that happen. Re-running the build to see if it's just a fluke.

@kring
Copy link
Member Author

kring commented Feb 1, 2025

Yeah that intermittent Android build error has been happening for awhile. As far as I can tell, it's some sort of race condition in OpenSSL's custom build process. Running the build again usually fixes it.

@kring kring merged commit 0769efa into main Feb 2, 2025
7 checks passed
@kring kring deleted the reinterop-exceptions branch February 2, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for exceptions to Reinterop
2 participants