Search Unity

IL2cpp windows build error

Discussion in 'Editor & General Support' started by blaher, Dec 8, 2017.

  1. blaher

    blaher

    Joined:
    Oct 21, 2013
    Posts:
    80
    Getting the following show stopper build error:

    "
    IL2CPP error for method 'System.Int32 CSCore.CoreAudioAPI.AudioCaptureClient::GetBufferNative(System.IntPtr&,System.Int32&,CSCore.CoreAudioAPI.AudioClientBufferFlags&,System.Int64&,System.Int64&)' in assembly 'C:\Users\friken\Documents\fractal\Fractalhuasca-UnityProject\Temp\StagingArea\Data\Managed\UnityEngine.dll'
    Additional information: Build a development build for more information. Unable to cast object of type 'Mono.Cecil.CallSite' to type 'Mono.Cecil.MethodReference'."

    not idea what that means or what to try, google search is failing me.
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    This might be a bug on the Unity side. Can you submit a bug report with a project that reproduces this issue?
     
    jashan likes this.
  3. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    @JoshPeterson Has this been addressed? I'm running into the same issue in Unity 2017.4.5f1.

    Basically, what seems to happen there is that any method using unsafe + something like this:

    Code (csharp):
    1. ((void**) (*(void**) UnsafeBasePtr)
    will fail. CSCore uses that a lot. I have started wrapping those parts in #if !ENABLE_IL2CPP ... but that's just a band-aid to make the project build so I can test some things. It would be great if this could be fixed in Unity. Here is the full error message I am getting in Unity 2017.4.5f1:

    Code (csharp):
    1. IL2CPP error for method 'System.Int32 CSCore.CoreAudioAPI.AudioClient::InitializeNative(CSCore.CoreAudioAPI.AudioClientShareMode,CSCore.CoreAudioAPI.AudioClientStreamFlags,System.Int64,System.Int64,CSCore.WaveFormat,System.Guid)' in AudioClient.cs:159
    2. Additional information: Exception of type 'System.Exception' was thrown.
    ... and this is one example method (which includes my band-aid conditional compilation):

    Code (csharp):
    1.         public unsafe int GetNextPacketSizeNative(out int numFramesInNextPacket) {
    2. #if !ENABLE_IL2CPP
    3.             fixed (void* p = &numFramesInNextPacket) {
    4.                 return InteropCalls.CallI(UnsafeBasePtr, p, ((void**)(*(void**)UnsafeBasePtr))[5]);
    5.             }
    6. #else
    7.             numFramesInNextPacket = 0;
    8.             UnityEngine.Debug.LogError("AudioCaptureClient.GetNextPacketSizeNative(...) not supported on IL2CPP");
    9.             return 0;
    10. #endif
    11.         }
     
    Peter77 likes this.
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    I don't believe that this has been addressed. Can you submit a bug report with a project that reproduces this issue?
     
  5. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Ah, yes, sorry - I filed some reports after I wrote the posting. That's

    (Case 1049545) IL2CPP Builds Fail for (void**)(*(void))

    and, a different issue because in that case we don't get the proper error message (which means it's extremely difficult to even figure out what the problem is):

    (Case 1049528) IL2CPP Fails without proper error message that helps isolate the issue

    I believe both bug reports have really good repro-projects (I literally spent two days isolating those issues, with 1049528 being the one that consumed most of the time because I had to tear the whole project apart and do builds with only small subsets of the project to isolate what was causing IL2CPP to fail.
     
    JoshPeterson likes this.
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    We will investigate these issue. Thanks!
     
    jashan likes this.