mono / Embeddinator-4000

Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
MIT License
758 stars 95 forks source link

No corresponding member object or method can be called after compilation #753

Closed ezraShenglei closed 4 years ago

ezraShenglei commented 4 years ago

Steps to Reproduce

1.My code

public class MyUIView : UITextView
{
    public string testValue;
    public MyUIView()
    {
        Text = "Hello from C# 15:05";
    }
    public void test() {
        Text = "test run";
    }
    public string getTestValue(){
        return testValue;
    }
}

2.objcgen /Users/wushenglei/Projects/hello-from-csharp/hello-from-csharp/bin/Debug/hello_from_csharp.dll --target=framework --platform=iOS --outdir=output -c --debug

Expected Behavior

Can use MyUIView member objects and methods in ViewController.m file in Xcode

Actual Behavior

TestValue and test functions not found

Environment

OSX 10.14.6 embeddinator-4000 0.40 Visual Studio for Mac 8.4 build 2653

Build Logs

Example Project (If Possible)

chamons commented 4 years ago

Can you please post the full build log, preferably with the project zipped up as well.

ezraShenglei commented 4 years ago

Can you please post the full build log, preferably with the project zipped up as well.

https://gist.github.com/chamons/930903fd6a641d139b5dc752d2bc30d3

hello_from_csharp.zip

ezraShenglei commented 4 years ago

Can you please post the full build log, preferably with the project zipped up as well. another example: My code: namespace hello_new_csharp {      public class Class1      {          public String text;          public Class1 ()          {              text = "Class1 C #";          }

     } } objcgen /Users/wushenglei/Projects/hello-new-csharp/hello-new-csharp/bin/Debug/hello_new_csharp.dll --target = framework --platform = iOS --outdir = output -c --debug

Error log after using this command

error MT2002: Failed to resolve assembly: 'System.Drawing.Common, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = cc7b13ffcd2ddd51'

Environment

OSX 10.14.6 embeddinator-4000 0.40 Visual Studio for Mac 8.4 build 2653 Xamarin.iOS Version: 13.10.0.17 (Visual Studio Community) .NET Core SDK 3.1.100

hello-new-csharp.zip

chamons commented 4 years ago

The embeddinator tool assumes that all requires assemblies are next to the library in question.

If you do something like cp /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/System.Drawing.dll . next to the library it binds.