Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Disable nunit since it conflicts with System.Collections.Concurrent

Discussion in 'Editor & General Support' started by AndersMalmgren, Apr 2, 2017.

  1. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Hi.
    We have upgraded to 5.6 and now get compile errors. We use the Concurrent collections in System.Threading, the ConcurrentQueue is also defined in nunit.framework so the code does not compile.
     
  2. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I reported a bug on this, it seems like a bug that nunit.framework define types with same strongly typed name as System.Threading
     
  3. CleverEndeavour

    CleverEndeavour

    Joined:
    Mar 4, 2016
    Posts:
    12
    I'm running into this issues as well.

    Report Case 897850

    Anybody know if there are work arounds to this problem>
     
  4. Michal-Leszczynski

    Michal-Leszczynski

    Joined:
    Aug 18, 2014
    Posts:
    5
    We have the same issue.
     
  5. rschu

    rschu

    Joined:
    Nov 22, 2016
    Posts:
    5
    Same issue here. Could not find a workaround that is reasonable.
     
  6. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,340
    To clear up, the problem isn't that NUnit has it's own ConcurrentQueue. It's that NUnit seems to drag along it's own version of System.Collections.Concurrent.

    Which means that this code won't compile:

    Code (csharp):
    1. public class Foo {
    2.     public void Bar() {
    3.         System.Collections.Concurrent.ConcurrentQueue<string> queue;
    4.     }
    5. }
    Which is an incredibly breaking bug. I think Unity automatically adds nunit as a dependency to projects these days. If you open the project in Visual Studio or something similar, and delete the nunit dependency, the code compiles in VS, but Unity dutifully ensures that the dependency's always there.

    The only possible work around is to wait for a patch or roll back to 5.5. Or create your own version of a concurrent queue?
    Edit: Looking into this further, it seems like the System.Collections.Concurrent exists in 5.5(1f1), so this is probably not a breaking change.
     
    Last edited: Apr 4, 2017
  7. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    We are on 5.5.3 and do not get the conflict
     
  8. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    We want to test out Vulkan and the new lighting mode so I hope Unity sorts out this fast. Our netcode is heavily dependent on the different concurrent classes in the System.Threading assembly
     
  9. CleverEndeavour

    CleverEndeavour

    Joined:
    Mar 4, 2016
    Posts:
    12
    Another factor for us is that we use the Gamesparks API which also defines System.Collections.Concurrent
     
  10. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    It would be better if Unity used their own namespace for this class so it does not conflict for us that import the Actual .NET assembly
     
  11. HaraldNielsen

    HaraldNielsen

    Unity Technologies

    Joined:
    Jun 8, 2016
    Posts:
    140
    Hi, so I have been looking into this.
    So the problem seem to come when more than one lib, as nunit and Gamesparks, implement System.Collections.Concurrent classes. .NET 2 that Unity ships with does not have fx. ConcurrentQueue.

    Im working on to find a workaround so you guys are not blocked, and hopefully have one soon.

    We are also fixing it, so there will not be any if these issues, in the next patch.
     
  12. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Just to be clear we use the 3.5 version of System.Threading assembly
     
    HaraldNielsen likes this.
  13. HaraldNielsen

    HaraldNielsen

    Unity Technologies

    Joined:
    Jun 8, 2016
    Posts:
    140
    Hi,

    So there are no way to alias assemblies in Unity, wich one useally would do with errors like this. But I fixed the problem in nunit, and are publishing the new assemblies here, so no one needs to wait for a new patch.
    http://files.unity3d.com/harald/nunit.zip

    Unpack and overwrite the existing nunit assemblies at this location: <Unity>\Editor\Data\UnityExtensions\Unity\TestRunner\

    If any have any more issues please tell. Hopefully this should solve your issues. Sorry for the inconvenience.
     
  14. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Thanks i can now compile, but I get GL.End requires material.SetPass before! when the game starts
     
  15. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I still get errors in VS2017 btw, but it seems to compile from within Unity
     
  16. devhead

    devhead

    Joined:
    May 15, 2017
    Posts:
    1
    Bumping this thread. Has anyone found a work around?
     
  17. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Works in 2017.1
     
  18. jberg8

    jberg8

    Joined:
    Sep 27, 2017
    Posts:
    1
    Hi,
    I'm getting the same problem in 2018.1.3 when I use the .NET 4 Equivalent Scripting Runtime Version and replacing the nunit files doesn't seem to fix it. Any help would be appreciated.