Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is JIT no longer supported on Standalone+Mono?

Discussion in 'Scripting' started by LazloBonin, May 2, 2019.

  1. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    809
    I'm investigating a bug report in Bolt where System.Reflection.Emit methods throw a PlatformNotSupportedException in a Windows Standalone build running on the Mono runtime.

    I expected it to fail on the IL2CPP runtime of course, but based on the table in the documentation (and from previous experience), it should work on Mono runtime:

    Did that change in recent versions? I'm running 2018.3.14f1 + .NET 4.x

    upload_2019-5-2_13-48-45.png
     
  2. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    809
    The call that causes the error is a DynamicMethod constructor:

    Code (CSharp):
    1. var setterMethod = new DynamicMethod
    2. (
    3.     "setter",
    4.     typeof(void),
    5.     new[] { typeof(TTarget), typeof(TField) },
    6.     typeof(TTarget),
    7.     true
    8. );
    9.  
    And the stack is:

    Code (CSharp):
    1.  
    2. System.PlatformNotSupportedException: Operation is not supported on this platform.
    3.   at Unity.ThrowStub.ThrowNotSupportedException () [0x00000] in <c6bd535f6ab848b4a13f34d01b756eef>:0
    4.   at System.Reflection.Emit.DynamicMethod..ctor (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner, System.Boolean skipVisibility) [0x00000] in <c6bd535f6ab848b4a13f34d01b756eef>:0
    5.  

    Again, I'm 99% sure that this worked in previous versions...
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    Are you sure you're targeting .NET 4.x in player settings, rather than .NET Standard 2.0?