Error in binding project : Cannot implicitly convert type System.Type to MyNamespace.Type (cs0029)

I've created a binding project to a 3rd party ios framework. For the most part, the appdefinition.cs Objective Sharpie generates is error free, and the errors I do have are of a similar nature

A lot of the interfaces are generated like this:

[Protocol, Model]
[BaseType(typeof(NSObject))]
interface ExampleDelegate
{
[Export("Initialized:")]
void Initialized(bool isInitialized);

[Export("canFind")]
void canFind(); 

}

Methods which take no parameters, such as canFind, produce no compilation errors. Methods taking parameters, such as Initialized, generate errors, "Cannot implicitly convert type System.Type to CustomNamespace.Type (CS0029)"

In the generated ExampleDelegate.g.cs file I can see that the problematic line is Parameter type declaration in the protocol member annotation below:

[Protocol (Name = "ExampleDelegate", WrapperType = typeof (ExampleDelegateWrapper))]
[ProtocolMember(.....)]
[ProtocolMember(IsRequired=false, IsProperty = false, IsStatic = false, Name = "isInitialized", Selector = "IsInitialized:", ParameterType = new Type [] { typeof (bool) }, ParameterByRef = new bool [] { false })]
public interface IExampleDelegate : INativeObject, IDisposable{}

I don't really understand this error, I know it has nothing to do with the 3rd party library itself, and is a more generic error you find when binding ios frameworks. Is there a common way to resolve errors like these?

Thanks

Brendan

Best Answer

  • bryan1bryan1 IEMember ✭✭
    Accepted Answer

    This was nothing to do with the binding project. The structs and enums file generated created hundreds of enums and one of them was just called Type and it was using that rather than System.Type in the generated *.g.cs file. I'll leave the post here, but if moderator wants to delete that is fine

Answers

  • bryan1bryan1 IEMember ✭✭
    Accepted Answer

    This was nothing to do with the binding project. The structs and enums file generated created hundreds of enums and one of them was just called Type and it was using that rather than System.Type in the generated *.g.cs file. I'll leave the post here, but if moderator wants to delete that is fine

Sign In or Register to comment.