grofit / unity-rx-test

A repo to check what problems rx.net 4.x and unity 2018.x have when building for IL2CPP
MIT License
3 stars 3 forks source link

Get tests running with IL2CPP #1

Open grofit opened 5 years ago

grofit commented 5 years ago

This is just a placeholder for conversation originally from https://github.com/neuecc/UniRx/issues/300

grofit commented 5 years ago

So looking into the failing tests in the unity editor, they seem to be related to the scheduler part of this, as Unity seems to be unable to provide or use the scheduler and blows up, not sure what needs to happen there with it but if anyone has any ideas please let us know.

This is what one of the errors looks like:

Cant_Locate_Scheduler (0.067s)
---
System.Runtime.Serialization.SerializationException : Unable to find assembly 'Assembly-CSharp-Editor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
---
Server stack trace: 
  at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly () [0x00046] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType (System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo assemblyInfo, System.String name) [0x00078] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor (System.String objectName, System.String[] memberNames, System.Runtime.Serialization.Formatters.Binary.BinaryTypeEnum[] binaryTypeEnumA, System.Object[] typeInformationA, System.Int32[] memberAssemIds, System.Runtime.Serialization.Formatters.Binary.ObjectReader objectReader, System.Int32 objectId, System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo assemblyInfo, System.Runtime.Serialization.Formatters.Binary.SizedArray assemIdToAssemblyTable) [0x00060] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectMap.Create (System.String name, System.String[] memberNames, System.Runtime.Serialization.Formatters.Binary.BinaryTypeEnum[] binaryTypeEnumA, System.Object[] typeInformationA, System.Int32[] memberAssemIds, System.Runtime.Serialization.Formatters.Binary.ObjectReader objectReader, System.Int32 objectId, System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo assemblyInfo, System.Runtime.Serialization.Formatters.Binary.SizedArray assemIdToAssemblyTable) [0x00000] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped (System.Runtime.Serialization.Formatters.Binary.BinaryObjectWithMapTyped record) [0x000dc] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped (System.Runtime.Serialization.Formatters.Binary.BinaryHeaderEnum binaryHeaderEnum) [0x0002e] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run () [0x000c9] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize (System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Runtime.Serialization.Formatters.Binary.__BinaryParser serParser, System.Boolean fCheck, System.Boolean isCrossAppDomain, System.Runtime.Remoting.Messaging.IMethodCallMessage methodCallMessage) [0x00069] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Boolean fCheck, System.Boolean isCrossAppDomain, System.Runtime.Remoting.Messaging.IMethodCallMessage methodCallMessage) [0x000a2] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Boolean fCheck, System.Runtime.Remoting.Messaging.IMethodCallMessage methodCallMessage) [0x00000] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Boolean fCheck) [0x00000] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at System.Runtime.Remoting.RemotingServices.DeserializeCallData (System.Byte[] array) [0x0000c] in <ac823e2bb42b41bda67924a45a0173c3>:0 
  at (wrapper xdomain-dispatch) System.AppDomain.DoCallBack(object,byte[]&,byte[]&)

Exception rethrown at [0]: 
  at (wrapper xdomain-invoke) System.AppDomain.DoCallBack(System.CrossAppDomainDelegate)
  at (wrapper remoting-invoke-with-check) System.AppDomain.DoCallBack(System.CrossAppDomainDelegate)
  at ReactiveTests.Tests.DefaultConcurrencyAbstractionLayerTest.Run (System.CrossAppDomainDelegate a) [0x00001] in C:\Code\Others\gh\unity-rx-test\RxUnityTest\Assets\Editor\Tests\Tests\DefaultConcurrencyAbstractionLayerTest.cs:31 
  at ReactiveTests.Tests.DefaultConcurrencyAbstractionLayerTest.Cant_Locate_Scheduler_NoPlib () [0x00019] in C:\Code\Others\gh\unity-rx-test\RxUnityTest\Assets\Editor\Tests\Tests\DefaultConcurrencyAbstractionLayerTest.cs:300 
  at ReactiveTests.Tests.DefaultConcurrencyAbstractionLayerTest.Cant_Locate_Scheduler () [0x00001] in C:\Code\Others\gh\unity-rx-test\RxUnityTest\Assets\Editor\Tests\Tests\DefaultConcurrencyAbstractionLayerTest.cs:290 
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <ac823e2bb42b41bda67924a45a0173c3>:0
dzmitry-lahoda commented 5 years ago

I was able to run tests in Play mode in IDE. I am trying to run on IL2CPP according documentation, but nothing happens. I have attached Android which I usually use for debugging. I was unable at all, not specifically this project. Need to check another time again.

dzmitry-lahoda commented 5 years ago

As of error, seems may try to setup up default static task factory or scheduler, implemented on top of unity event loop. There is SynchronizationContext for unity on github, and there are schedulers which use SynchronizationContext (single thread schedulers), if to search initialization of scheduler in Rx and may be replace.

dzmitry-lahoda commented 5 years ago

My colleague qa-devops have read and tried Unity tests. As it appears Unity tests are not run on devices, they just run in editor but build for like Android (so not IL2CPP or any other dependencies). Docs are not very clear on this....

grofit commented 5 years ago

From my brief conversation with superpig he said it was all possible and you had to use them in playmode on a different build target. I recommend nipping into unitydevs slack or their discord channel and asking as like you say the docs are not the best

RDeluxe commented 5 years ago

Where are we on this, and how can I help ?

grofit commented 5 years ago

I had done most of the work I could do to get the project in a runnable state, it just needed someone to run them on all potential platforms and see what tests fail and then see if there is a simple avenue to fix them.

The guys in the UnityDevSlack seemed pretty open to discussing how to run the tests etc (assuming you have the hardware to run them on), and the guys in the ReactiveSlack seemed happy to discuss the potential AOT problems and see if there are any work arounds or changes that could be done, there was one guy there who says he uses rx.net in a lot of AOT scenarios via ReactiveUI(?) which he made, and he was very helpful, the only missing link is knowing what stuff is broken to be able to discuss solutions and verify them with the rx guys.

So we have peoples ears and we have a project as a baseline, we just need someone to be able to run all the tests on the actual hardware in real world scenarios to see if they pass/fail and isolate the changes needed to make it pass to see if we can get the rx.net guys to get any of the changes in.

RDeluxe commented 5 years ago

Ok, I may be able to run those tests on Android devices, apparently the only thing we need to figure out is how to run them on devices. I'll join the UnityDevSlack then

SiriusA7 commented 5 years ago

I have my oculus quest I can test something on... If someone points me in the right direction...

Trying to get a grip on reactive programming and fell down this rabbits hole.

Should I just try building and deploying the sample scene.?

dzmitry-lahoda commented 5 years ago

things look to be more trivial. there are rumors that nunit tests may run on devices. and there is no docs how to do it. the quest to find rigth command line parameters to run tests o e devices via unity. and than fik all failing tests.

dzmitry-lahoda commented 5 years ago

next step is to fix tests which do not run on il2cpp but run in unity editor tests. drill into implementation of rx and find out why these fail.

grofit commented 5 years ago

Sorry late to the party again, @RDeluxe did you manage to get any info from the slack channel about how to run the tests properly? as I think once we have that everyone should be free to just run them and look at the problems.

waitxd commented 5 years ago

@grofit Have you tried using a https://github.com/Cysharp/RuntimeUnitTestToolkit ?

grofit commented 5 years ago

I didnt really do much testing other than getting the original test suite up and running, I dont have many devices to run on here so left it to everyone else to test what they could. Good find though!

grofit commented 4 years ago

Did anyone get any further with this stuff? I am again wishing that I could use System.Reactive in unity with a couple of the unirx helpers.

RDeluxe commented 4 years ago

Nope, I did not have time on my side just yet.