NotSupportedException get_HasShutdownStarted - "This icall is not supported by il2cpp

Hi,

I’m getting the following exception from my iOS App:

NotSupportedException: /Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System/Environment.cpp(166) : Unsupported internal call for IL2CPP:Environment::get_HasShutdownStarted - "This icall is not supported by il2cpp

This is the C# stackstrace that I have:

System.Threading.ThreadPoolWorkQueueThreadLocals.Finalize () (at <00000000000000000000000000000000>:0)
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)

Anything I can do?

Unfortunately, there is not much you can do to correct this issue. It is a known bug on our side which we have corrected. The fix for it should in the 2017.1.1p3 patch release.

Ok, Thanks!

I am still getting the same error in Unity 2017.2.0f2 on iPad Air 2 build from Xcode.

NotSupportedException: /Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System/Environment.cpp(166) : Unsupported internal call for IL2CPP:Environment::get_HasShutdownStarted - “This icall is not supported by il2cpp.”
at System.Threading.ThreadPoolWorkQueueThreadLocals.Finalize () [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.UnhandledExceptionHandler:PrintException(String, Exception)
UnityEngine.UnhandledExceptionHandler:HandleUnhandledException(Object, UnhandledExceptionEventArgs)
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)

(Filename: currently not available on il2cpp Line: -1)\

I fix did not make the 2017.2 release. It will be in the 2017.2.0p2 patch release, when that is available (it should be soon). You can find the patch releases here: https://unity3d.com/unity/qa/patch-releases

1 Like

Hi,

I’ve updated to version 2017.2.0p2 and the above error is gone.
However, now I’m getting the following exception and my app crash :frowning:

/Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System/AppDomain.cpp(189) : Unsupported internal call for IL2CPP:AppDomain::InternalIsFinalizingForUnload - “This icall is not supported by il2cpp”

Is this a known issue? Can I do something to solve it?

Yes, this is a different known issue. A fix is on the way to a patch release soon.

OK, is there something that we can do to workaround this? Or maybe we’re doing something wrong? When does the above method get called?

We waited for the mentioned patch, really bad, and now we’re just getting the same behavior but with different exception…
Now our iOS app crashes all the time, due to this missing implementation…

You’re not doing anything wrong - it is a bug on the Unity side. I think this only occurs with the new scripting runtime and .NET 4.6 though. If possible you can switch to the old scripting runtime and .NET 2.0 - this problem should go away.

Switching back to the old scripting runtime is not an option for us…

Ok, the fix for this will be landing in a patch release soon then. In meantime, you might be able to work around this by modifying the generated C++ code in the Xcode project. Search the generated code for “InternalIsFinalizingForUnload_m”. That generated method should call the unimplemented version of the InternalIsFinalizingForUnload method in the runtime. You can return false in the generated code instead of making the call into the runtime.

This is not a great workaround, but I think it will work.

Ok, I’ll try that, thanks.

Can you be more specific about which patch release?

It should be fixed in 2017.2.1p1 and the first 2017.3 patch release. It probably will not make the 2017.3 full release though.

NotSupportedException: /Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System/Environment.cpp(166) : Unsupported internal call for IL2CPP:Environment::get_HasShutdownStarted - "This icall is not supported by il2cpp

Getting this in 2017.2.0p3. Did you not say it was fixed in p2?

Sorry, there was a delay getting our fixes into the patch release. I’ve just checked the release branch for 2017.2, and the fix is there, so this should be in the next patch release.

Alright, thanks :slight_smile:

Hi. Is there any version/patch of Unity which does not have these bugs today?

2017.3p1 still the same error. :frowning:

Hi,
I’m still getting this

Non-fatal Exception: /Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System/AppDomain.cpp(189)
Unsupported internal call for IL2CPP:AppDomain::InternalIsFinalizingForUnload - “This icall is not supported by il2cpp.”

/Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System/AppDomain.cpp(189)
0 (Missing) 0x0 Finalize (System.Threading.ThreadPoolWorkQueueThreadLocals)

This is serious problem for us can you please provide some details. Is this somehow connecting with exception handling or maybe UdpClient?

Version is 2017.3.0f3

Also is exception handling on iOS is going to be stable any time soon?
System libraries like UdpClient rely on Exceptions, would we get more stable results if we switch to Berkley sockets and native c++ implementation?