C# Cocoa library incorrect scope of properties


this code:

namespace StaticLibrary
	public class Test
		public string FirstName { get; private set; }
		private string LastName { get; set; }
		public int Age { private get; set; }

… results in this header:

@class __StaticLibrary_Test;

@interface __StaticLibrary_Test: NSObject

@property (strong) NSString * _Null_unspecified FirstName;
@property (assign) int32_t Age;


I would expect to see FirstName marked as readonly and Age to be defined as -setAge: since there are no write only properties in Objective-C.

Thanks, logged as bugs://77251

bugs://77251 got closed with status fixed.

Cool! Same goes for internal obviously. I guess protected would be hard if not impossible to translate to ObjC however.

Another inconsistency I noticed is how nested classes translate to ObjC. Check out this example:

namespace StaticLibrary {
	public class ClassInNamespace {
		public class ClassInClass {
			public string Test { get; set; }

this translates to this in ObjC:

@interface __StaticLibrary_ClassInNamespace: NSObject

@interface ClassInClass: NSObject
@property (strong) NSString * _Null_unspecified Test;

In this case the nested class is not properly prefixed with the namespace and parent class name. I would expect the class name in ObjC to be __StaticLibrary_ClassInNamespace_ClassInClass.

And one more…
Storage modifiers don’t seem to be correctly translated to ObjC headers.

namespace StaticLibrary {
	public class Controller { }
	public class WeakTest {
		public __weak Controller Delegate { get; set; }

translates to:

@interface __StaticLibrary_Controller: NSObject

@interface __StaticLibrary_WeakTest: NSObject
@property (strong) __StaticLibrary_Controller * _Null_unspecified Delegate;

Same goes for __unretained.

Logged as bugs://i64995.

bugs://i64995 was closed as fixed.