xamarin / binding-tools-for-swift

MIT License
160 stars 21 forks source link

handle virtual methods with closures that throw #753

Closed stephen-hawley closed 3 years ago

stephen-hawley commented 3 years ago

This adds the ability to handle exactly one type of function that throws: F<TR, T>. Rather than bury you in the spew of many changes, I thought I'd keep this PR simple. The fire hose happens next PR.

To do this, I added an optional argument to MakeDelegateFromBlindClosure that includes flags to indicate whether the delegate can throw or is async.

The SwiftToCSharp marshaling now handles closures that throw - this just involves calling the right adapter, but other than that, it's pretty much the same code.