Search Unity

Bug UWP doesn't compile if Play Test Mode Enabled

Discussion in 'Testing & Automation' started by maxim-vr, Nov 21, 2017.

  1. maxim-vr

    maxim-vr

    Joined:
    Aug 8, 2017
    Posts:
    2
    FYI
    I discovered that if "ProjectSettings.asset" file contains parameter "playModeTestRunnerEnabled: 1" (Play Test Mode is Enabled), then UWP project does not compile, because of compilation errors that are related to Test Runner assembly.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    This is a known issue with .NET scripting backend. It does not manifest if you're using IL2CPP. We have people working on fixing that.
     
  3. maxim-vr

    maxim-vr

    Joined:
    Aug 8, 2017
    Posts:
    2
    Thank you Tautvydas-Zilys for quick reply.
    We are generating VS2017 project\solution (need to configure some UWP params and to change some generated code). We are not building package directly in unity.
    We will be very happy if you will give us some estimation for this problem fix.
     
  4. devluz

    devluz

    Joined:
    Aug 20, 2014
    Posts:
    66
    The problem still exists in Unity 2017 LTS. Is there any fix by now or will I have to edit the file manually? It makes automatic build & test servers pretty difficult to handle as they need to have the testrunner active but also need to be able to build UWP
     
  5. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
    I'm having this issue (two years later) on 2019.3.0f3 right now.

    The API it's internal so I created a snippet that disables it via reflection:

    https://github.com/Unity-Technologi.../Editor/Mono/PlayerSettings.bindings.cs#L1145

    Code (CSharp):
    1. public static void DisablePlayModeTestsForAllAssemblies() {
    2.         Assembly unityEditorAssembly = AppDomain.CurrentDomain
    3.             .GetAssemblies()
    4.             .FirstOrDefault(e => e.GetName().Name.Equals("UnityEditor"));
    5.  
    6.         Type playerSettingsType = unityEditorAssembly.GetType("UnityEditor.PlayerSettings");
    7.  
    8.         PropertyInfo playModeTestRunnerEnabledProperty = playerSettingsType.GetProperty("playModeTestRunnerEnabled", BindingFlags.Static | BindingFlags.NonPublic);
    9.      
    10.         playModeTestRunnerEnabledProperty.SetValue(false, null);
    11.     }
    @Tautvydas-Zilys any news?

    My problem is that I'm using batch mode with Test Runner and Code Coverage packages and they seem to enable automatically this value and later if I make another build for UWP it will fail because of this value set to true.
     
    Last edited: Dec 30, 2019
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    This seems like a totally separate issue. The original issue only affected .NET scripting backend and that doesn't exist in 2019.3 anymore. Can you report a bug on this?
     
  7. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
    It is really easy to reproduce.

    Here you have: Case 1208398
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    Thanks, we'll take a look.
     
  9. AlexStark_

    AlexStark_

    Joined:
    Oct 19, 2018
    Posts:
    2
    We are facing the same issue in 2019.4.0f1. Setting "playModeTestRunnerEnabled: 0" in "ProjectSettings.asset" solves the problem for now. Any news on a real solution? I cannot see the Case above...
     
  10. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
  11. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
    Bump @Tautvydas-Zilys... How is this going?

    Almost one year since the bug report.
     
  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    I pinged the team responsible for this area. Sorry for the lack of progress.