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 41512 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
Created attachment 16197 [details]
[PlainString] usage sample
When you are binding an Objective-C class method with `const char *` as parameter, you need to add [PlainString] attribute to C# parameter so, when you pass a string, it passes, literally, a string and not the reference of a NSString.
// @interface CStringTest : NSObject
[BaseType (typeof (NSObject), Name = "CStringTest")]
// - (void)CStringMethodWithMessage:(const char *)message;
void CStringMethod ([PlainString] string message);
But when you have a protocol method with `const char *` as parameter and you add [PlainString] attribute to C# parameter, it compiles but it crashes at runtime:
// @protocol CStringDelegate <NSObject>
[BaseType (typeof (NSObject))]
// @required - (void)CStringRequiredMethodWithMessage:(const char*)message;
void CStringAbstractMethod ([PlainString] string message);
Does this is a bug?
I attached a sample that has the Xcode project, Binding project and a sample that reproduce the bug.
> Does this is a bug?
Yes, you found a missing feature, thanks for the report! I can reproduce it with the test case you provided.