SocketIOUnity icon indicating copy to clipboard operation
SocketIOUnity copied to clipboard

IL2CPP Problem Resolution

Open ZhouXinyu001 opened this issue 2 years ago • 4 comments

I have found the reason why IL2CPP faster runtime cannot run.

It is mainly due to the fact that System.Reactive.Subjects.Subject cannot be translated properly when full generic sharing is not supported in IL2CPP.

It is expected that UniRx (https://github.com/neuecc/UniRx) can be used to solve this issue.

Error code Location: image

Error Stack: System.ExecutionEngineException: Attempting to call method 'System.Reactive.Concurrency.CurrentThreadScheduler::Schedule<System.ValueTuple2[[System.Action1[[System.ValueTuple2[[System.Reactive.Producer2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Reactive.Linq.ObservableImpl.AsObservable1+_[[System.String, mscorlib, Version=[4.0.0.0](http://4.0.0.0/), Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Reactive, Version=[5.0.0.0](http://5.0.0.0/), Culture=neutral, PublicKeyToken=94bc3704cddfc263]], System.Reactive, Version=[5.0.0.0](http://5.0.0.0/), Culture=neutral, PublicKeyToken=94bc3704cddfc263],[System.Reactive.Linq.ObservableImpl.AsObservable1+[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Reactive, Version=5.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.ValueTuple2[[System.Reactive.Producer2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Reactive.Linq.ObservableImpl.AsObservable1+_[[System.String, mscorlib, Version=[4.0.0.0](http://4.0.0.0/), Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Reactive, Version=[5.0.0.0](http://5.0.0.0/), Culture=neutral, PublicKeyToken=94bc3704cddfc263]], System.Reactive, Version=[5.0.0.0](http://5.0.0.0/), Culture=neutral, PublicKeyToken=94bc3704cddfc263],[System.Reactive.Linq.ObservableImpl.AsObservable1+[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Reactive, Version=5.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>' for which no ahead of time (AOT) code was generated. Consider increasing the --generic-virtual-method-iterations=1 argument

ZhouXinyu001 avatar Dec 26 '23 10:12 ZhouXinyu001

Thank you for reporting this issue. I'm currently tied up with other commitments if you or the community find a fix, please consider submitting a pull request. Your contribution is highly valued.

itisnajim avatar Feb 06 '24 20:02 itisnajim

in IL2CPP build socket.io couldn't connect to server without any error but when I updated my unity from 2021.x to 2022.3.20, problem fixed.

noobogami avatar Mar 13 '24 13:03 noobogami

Hi, Big thanks for this bug search.

I did not do a deep search in socket.io client source code, but between the 3.0.6 and 3.0.8 versions they did some refactoring and they do not use Subscribe anymore. So this pending pull request, updateing library from 3.0.6 to 3.0.8, seem to fix this issue.

I changed my package.json in unity to use the forked repository and I'm now able to connect to my server in android.

FEsteven avatar Jun 03 '24 16:06 FEsteven

Hi, Big thanks for this bug search.

I did not do a deep search in socket.io client source code, but between the 3.0.6 and 3.0.8 versions they did some refactoring and they do not use Subscribe anymore. So this pending pull request, updateing library from 3.0.6 to 3.0.8, seem to fix this issue.

I changed my package.json in unity to use the forked repository and I'm now able to connect to my server in android.

This fix my problem too. Thanks!

EwertonLug avatar Jun 05 '24 19:06 EwertonLug