InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

UWP - Ambiguous references when using Scripting Runtime Version 4.x Equivalent

Open jackpr-unity opened this issue 8 years ago • 13 comments

Reproduction Steps:

  1. Create a new project with the InputSystem module
  2. Change build platform to UWP
  3. Change PlayerSettings->Configuration -> Scripting Runtime Version to ".NET 4.x Equivalent"

Expected: No compile issues

Observed: Numerous Ambiguous calls between System/System.Collections.Generic and UnityEngine.Experimental.Input.Net35Compatibility

Notes:

  • Reproduced with 2018.2.0b11 and Trunk rev 96052d777ea1
  • InputSystem\Utilities\Net35Compatibility.cs has include guards that look like they are meant to correct this. Perhaps these include guards have changed?
  • Example Error: C:/Users/jackpr/AppData/Local/Unity/cache/packages/staging-packages.unity.com/[email protected]/InputSystem/Actions/InputActionManager.cs(465,42): error CS0104: IReadOnlyList' is an ambiguous reference between System.Collections.Generic.IReadOnlyList' and `UnityEngine.Experimental.Input.Net35Compatibility.IReadOnlyList'

jackpr-unity avatar Jul 02 '18 20:07 jackpr-unity

This only occurs on UWP - updating reproduction steps accordingly

jackpr-unity avatar Jul 02 '18 20:07 jackpr-unity

Hmm, IIRC Doug fixed this on UWP just a short while ago. Wonder what changed.

Rene-Damm avatar Jul 03 '18 09:07 Rene-Damm

This can be reproduced with trunk from yesterday (96052d777ea1) and

  • package 0.0.4-preview
  • github commit 48a0ef565230043b210cdac0b8c87adb8523bb7d

jackpr-unity avatar Jul 03 '18 16:07 jackpr-unity

ok, been debugging this with Jon. Its very ugly. Short answer is in the editor when the target is set for UWP. The UWP platform has no way defined to know if we are new or old runtime. They completely ignore NET_4_0, etc, etc

The long answer has to do with UWP and Net 4.0 and the editor and what came first back in the day. the build defines and flags that are passed at compile time in the editor. Right now there is no quick fix for this without talking to Tautvydaus and coming up with a solution. No matter what we define in our code we will always get one of two possible problems. If we are on new runtime, we get ambiguous twice defined, if old, we get not defined.

Right now only work around is set to the new runtime, and put a !UNITY_WSA around UnityEngine.Experimental.Input.Net35Compatibility

douglas-piconi avatar Jul 10 '18 18:07 douglas-piconi

I have spent another two days digging deep into this. Right now I am convinced there is nothing we can do in our code without some help from the UWP team. The compile flags that are passed are the same between both old an new runtime on UWP based on what I see in editor logs. even tried messing with NETFX_CORE after talking to Tautvydaus. Still does not work. I can't just add any flags like Netstandard or 4_x, because it compile steps and the way UWP uses the runtime is way too complicated to just add some flags.

I personally think we should say if you want to use the new input system on UWP. You have to use 4.x and IL2CPP since everything else will be deprecated anyway. They are also phasing out .NET scripting on UWP and it will be 100% IL2CPP. Then in the #IF for using the 35Compatibility class we never allow it for UWP.

douglas-piconi avatar Jul 13 '18 18:07 douglas-piconi

I also took a swing and I'm seeing the issue described with the ambiguous references.

Under 4.x I see 19 ambiguous references. Under 3.5 I see 33 ambiguous references. All other settings are standard WMR settings .Net backend 4.x runtime Multi Pass

I see the errors when I try to build the vS SLN from Unity.

JasonCostanza avatar Aug 08 '18 21:08 JasonCostanza

I am still seeing this issue on 2018.3.0b2.

Scripting Runtime Version: .Net 4.x Equivalent (3.5 is marked as deprecated) Scripting Backend: IL2CPP Api Compatibility Level: .Net 4.x

jackpr-unity avatar Sep 18 '18 20:09 jackpr-unity

Since .Net 3.5 is deprecated, UWP is, from my perspective, broken. This 100% must be fixed for 19.1!

jackpr-unity avatar Sep 18 '18 22:09 jackpr-unity

@jackpr-unity Looks like this problem is outside of the input system code. Right now, the script compiler is broken and wrong for UWP in both the editor and the player. The pre compile defines that we use do not do anything. I'm messaging the scripting team and found a fogbugz bug that has already been filed by someone else, and will try to get this priority and user pain possibly bumped up.

douglas-piconi avatar Sep 19 '18 20:09 douglas-piconi

https://fogbugz.unity3d.com/f/cases/1075345/

douglas-piconi avatar Sep 19 '18 20:09 douglas-piconi

If we say that we don't support .Net 3.5, wouldn't the issue be resolved by removing the 3.5 compatibility script from the package?

jackpr-unity avatar Sep 19 '18 22:09 jackpr-unity

@douglas-piconi https://fogbugz.unity3d.com/f/cases/1075345/ has been resolved

jackpr-unity avatar Oct 31 '18 00:10 jackpr-unity

Resolved by the scripting team.

douglas-piconi avatar Nov 01 '18 17:11 douglas-piconi