Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: phoenix on November 18, 2015, 02:00:34 AM

Title: il2cpp error on Disconnect
Post by: phoenix on November 18, 2015, 02:00:34 AM
I am receiving this error when I try to stop a game server.

NotSupportedException: /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System.Threading/Thread.cpp(367) : Unsupported internal call for IL2CPP:Thread::Abort_internal - "Thread abortion is currently not implemented on IL2CPP; it is recommended to use safer mechanisms to terminate threads."
  at TNet.GameServer.Stop () [0x00000] in <filename unknown>:0
  at TNServerInstance.Disconnect () [0x00000] in <filename unknown>:0

Accoring to this post, it looks like unity is not going to support Thread.Abort
http://forum.unity3d.com/threads/4-6-ios-64-bit-beta.290551/page-16

And according to this post maybe we can call interrupt instead?
http://stackoverflow.com/questions/3632149/question-about-terminating-a-thread-cleanly-in-net/3632642#3632642

Any suggestions on stopping a game server for ios il2cpp?
Title: Re: il2cpp error on Disconnect
Post by: ArenMook on November 18, 2015, 04:29:32 PM
That's such a silly decision on their end... ok, they don't want to support the function, fine.. why not make it default to calling Interrupt() then? Boggles my mind...

I would say change it to Interrupt() and see if it works as expected. I went through and simply did:
  1. #if UNITY_IPHONE
  2.                         mThread.Interrupt();
  3. #else
  4.                         mThread.Abort();
  5. #endif
Title: Re: il2cpp error on Disconnect
Post by: zoon on December 08, 2015, 11:15:11 AM
I managed to open bug report on this. You can vote here:
https://issuetracker.unity3d.com/issues/il2cpp-notsupportedexception-is-thrown-when-calling-socket-dot-dispose-from-httplistener

Context:
http://forum.unity3d.com/threads/4-6-ios-64-bit-beta.290551/page-47#post-2392651
Title: Re: il2cpp error on Disconnect
Post by: Shifty Geezer on May 29, 2016, 02:20:57 PM
Sorry for the revisit here but needing to finish and release a product before updating to later Unitys and TNet 3, and this one's bit me in the butt. Where exactly do I make the above code changes (Using TNet 2) to enable server termination on il2cpp? Thanks
Title: Re: il2cpp error on Disconnect
Post by: cmifwdll on May 29, 2016, 06:29:03 PM
If you press Ctrl+F while Visual Studio (or whatever IDE you use) has focus, it'll bring up a search button. You can adjust the search options to search through the entire solution. From there, the search term I chose was ".Abort();". I came up with 4 results:
TNTcpLobbyServer.cs - Stop() function
TNUPnP.cs - Close() function
TNGameServer.cs - Stop() function
TNUdpLobbyServer.cs - Stop() function
Title: Re: il2cpp error on Disconnect
Post by: Shifty Geezer on May 30, 2016, 03:48:15 AM
That's sensible. I hadn't thought that I need to replace all instances of Abort().