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

Code that contains public events results in errors #671

Open lemonmojo opened 6 years ago

lemonmojo commented 6 years ago

Steps to Reproduce

  1. Invoke E4k on a library that contains public event declarations

Expected Behavior

  1. E4k compiles the native code and issues "unsupported" warnings for any events

Actual Behavior

  1. E4k doesn't compile the native code and issues errors instead of just "unsupported" warnings

Environment

Embeddinator-4000 v0.1 (0.4: 7664197)

Build Logs

Building: ELib (Debug)
Build started 5/11/2018 10:54:00 AM.
__________________________________________________
Project "/PATH/ELib.csproj" (Build target(s)):

Target _CoreCompileInterfaceDefinitions:
      BundleResources Output:
      OutputManifests Output:
Target GenerateTargetFrameworkMonikerAttribute:
  Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
Target CoreCompile:
  Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
Target CopyFilesToOutputDirectory:
    ELib -> /PATH/ELib.dll
Target RunEmbeddinator:
    /PATH/packages/Embeddinator-4000.0.4.0/tools/objcgen bin/Debug/ELib.dll --target=framework --platform=macOS-modern --abi=x86_64 --nativeexception --compile --debug --outdir=bin/Debug/
    Symbol file /PATH/packages/Embeddinator-4000.0.4.0/tools/IKVM.Reflection.pdb doesn't match image /PATH/packages/Embeddinator-4000.0.4.0/tools/IKVM.Reflection.dll
    Parsing assemblies...
        Parsed 'bin/Debug/ELib.dll'
    Processing assemblies...
        4 types found
    EXEC : warning EM1010: Type `System.EventHandler`1[System.EventArgs]` is not generated because `generics` are not supported.
    EXEC : warning EM1031: Method `Void add_TestEvent3(System.EventHandler`1[System.EventArgs])` is not generated because of parameter type `System.EventHandler`1[System.EventArgs]` is not supported.
    EXEC : warning EM1031: Method `Void remove_TestEvent3(System.EventHandler`1[System.EventArgs])` is not generated because of parameter type `System.EventHandler`1[System.EventArgs]` is not supported.
    EXEC : warning EM1011: Type `System.Object` is not generated because it lacks a native counterpart.
    EXEC : warning EM1020: Constructor `Void .ctor(System.Object, System.IntPtr)` is not generated because of parameter type `System.Object` is not supported.
    EXEC : warning EM1031: Method `Void Invoke(System.Object, ELib.EventTest+TestEventEventArgs)` is not generated because of parameter type `System.Object` is not supported.
    EXEC : warning EM1031: Method `IAsyncResult BeginInvoke(System.Object, ELib.EventTest+TestEventEventArgs, System.AsyncCallback, System.Object)` is not generated because of parameter type `System.Object` is not supported.
    EXEC : warning EM1031: Method `IAsyncResult BeginInvoke(System.Object, ELib.EventTest+TestEventEventArgs, System.AsyncCallback, System.Object)` is not generated because of parameter type `System.Object` is not supported.
    Generating binding code...
    EXEC : error EM0009: The feature `Converting type System.EventHandler to mono code` is not currently supported by the tool
    Debug Log:
    Processing: 1 assemblies
    Processing Assembly: ELib
    Processing Type: ELib_Person
    TypeMapper Register: System.Void .ctor() init
    TypeMapper Register: System.Void .ctor(System.String,System.String) initWithFirstName:lastName:
    TypeMapper Register: System.Void DoIntesiveWork() doIntesiveWork
    TypeMapper Register: System.String get_FirstName() getFirstName
    TypeMapper Register: System.String get_FullName() getFullName
    TypeMapper Register: System.String get_LastName() getLastName
    TypeMapper Register: System.Void Print(System.String) printStr:
    TypeMapper Register: System.Void set_FirstName(System.String) setFirstName:
    TypeMapper Register: System.Void set_LastName(System.String) setLastName:
    TypeMapper Register: System.Void ThrowException() throwException
    TypeMapper Register: System.Void ThrowException(System.String) throwExceptionMessage:
    TypeMapper Register: ELib.Person FirstName firstName setFirstName
    TypeMapper Register: ELib.Person FullName fullName
    TypeMapper Register: ELib.Person LastName lastName setLastName
    Processing Type: ELib_EventTest
    TypeMapper Register: System.Void .ctor() init
    TypeMapper Register: System.Void add_TestEvent(ELib.EventTest+TestEventDelegate) addTestEvent:
    TypeMapper Register: System.Void add_TestEvent2(System.EventHandler) addTestEvent2:
    TypeMapper Register: System.Void RaiseTestEvent() raiseTestEvent
    TypeMapper Register: System.Void RaiseTestEvent2() raiseTestEvent2
    TypeMapper Register: System.Void RaiseTestEvent3() raiseTestEvent3
    TypeMapper Register: System.Void remove_TestEvent(ELib.EventTest+TestEventDelegate) removeTestEvent:
    TypeMapper Register: System.Void remove_TestEvent2(System.EventHandler) removeTestEvent2:
    Processing Type: ELib_EventTest_TestEventEventArgs
    TypeMapper Register: System.Void .ctor() init
    Processing Type: ELib_EventTest_TestEventDelegate
    TypeMapper Register: System.Void EndInvoke(System.IAsyncResult) endInvokeResult:
    Begin Generator
    Generating Assembly: ELib
    Generating Type: ELib_EventTest
    Generating Method: System.Void add_TestEvent(ELib.EventTest+TestEventDelegate)
    Generating Method Impl: System.Void add_TestEvent(ELib.EventTest+TestEventDelegate)
    Generating Method: System.Void add_TestEvent2(System.EventHandler)
    Generating Method Impl: System.Void add_TestEvent2(System.EventHandler)
    /PATH/Embeddinator-4000.targets(3,3): error MSB3073: The command "PATH/packages/Embeddinator-4000.0.4.0/tools/objcgen bin/Debug/ELib.dll --target=framework --platform=macOS-modern --abi=x86_64 --nativeexception --compile --debug --outdir=bin/Debug/" exited with code 1.
Done building target "RunEmbeddinator" in project "ELib.csproj" -- FAILED.

Done building project "ELib.csproj" -- FAILED.

Build FAILED.

EXEC : warning EM1010: Type `System.EventHandler`1[System.EventArgs]` is not generated because `generics` are not supported.
EXEC : warning EM1031: Method `Void add_TestEvent3(System.EventHandler`1[System.EventArgs])` is not generated because of parameter type `System.EventHandler`1[System.EventArgs]` is not supported.
EXEC : warning EM1031: Method `Void remove_TestEvent3(System.EventHandler`1[System.EventArgs])` is not generated because of parameter type `System.EventHandler`1[System.EventArgs]` is not supported.
EXEC : warning EM1011: Type `System.Object` is not generated because it lacks a native counterpart.
EXEC : warning EM1020: Constructor `Void .ctor(System.Object, System.IntPtr)` is not generated because of parameter type `System.Object` is not supported.
EXEC : warning EM1031: Method `Void Invoke(System.Object, ELib.EventTest+TestEventEventArgs)` is not generated because of parameter type `System.Object` is not supported.
EXEC : warning EM1031: Method `IAsyncResult BeginInvoke(System.Object, ELib.EventTest+TestEventEventArgs, System.AsyncCallback, System.Object)` is not generated because of parameter type `System.Object` is not supported.
EXEC : warning EM1031: Method `IAsyncResult BeginInvoke(System.Object, ELib.EventTest+TestEventEventArgs, System.AsyncCallback, System.Object)` is not generated because of parameter type `System.Object` is not supported.
EXEC : error EM0009: The feature `Converting type System.EventHandler to mono code` is not currently supported by the tool
/PATH/Embeddinator-4000.targets(3,3): error MSB3073: The command "/PATH/packages/Embeddinator-4000.0.4.0/tools/objcgen bin/Debug/ELib.dll --target=framework --platform=macOS-modern --abi=x86_64 --nativeexception --compile --debug --outdir=bin/Debug/" exited with code 1.
    8 Warning(s)
    2 Error(s)

Time Elapsed 00:00:00.40

---------------------- Done ----------------------

Build: 2 errors, 8 warnings

Example Project (If Possible)

https://github.com/lemonmojo/EmbeddinatorTest18