Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 17550 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
2. C# does not allow a parameter type of "any kind of delegate." Therefore, to expose functionality similar to the Objective-C version, I think the corresponding C# `JSValue.From()` overload would need either to:
A. Require the user to wrap up the callback delegate within a `void`, parameterless delegate (an `Action`).
B. Require the user to pass in a `MethodInfo` object rather than an `Action`. This option might not work: I'm not sure if `MethodInfo` contains all the necessary information.
## A little more background
>  See the JSObjectMakeFunctionWithCallback() function on:
Note: the `wrapperForObject:` method is usually called indirectly as the result of a call to `[JSValue valueWithObject:inContext:]`, which is defined in:
## Possible solutions?
### Create `NSBlocks` from C# `Actions` at runtime
Another solution might be to make the new `JSValue.From()` overload (that takes `Actions` or `MethodInfos`) include some fancy logic to create an intermediary callback `NSBlock` for _any_ input delegate at runtime. On the other hand, I think this might require creating new trampoline types at runtime, and I'm not sure that's technically possible considering that SRE is unavailable on iOS.
## Version information
Any plans for adding this functionality?
See Bug 23474, Comment 3 through Bug 23474, Comment 5 for more details about that.
That alternate strategy might be sufficient for many use cases.