Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Mono Upgrade Feedback on the new preview build

Discussion in 'Experimental Scripting Previews' started by bdominguezvw, Feb 3, 2017.

  1. bdominguezvw

    bdominguezvw

    Joined:
    Dec 4, 2013
    Posts:
    96
    I've successfully tested the following libraries (using NUGET from the generated solution and copying "packages" folder dll to assets folder):

    - Entity Framework 6.1.3
    - JSON .NET 9.0.1
    - EPPlus 4.1.0
    - iTextSharp 5.5.10
    - SharpZipLib 0.86.0

    On the following platforms:

    - Windows 10 64 bits
    - Android 7.1

    One question. Have you discussed how are you going to deal with nuget packages? Now I have to copy them manually like I said.

    Congratulations! I'm looking forward to see more and more updates on this scripting builds.
     
    Qbit86, Thaina and rakkarage like this.
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Thanks for trying out the new build with these libraries, we really appreciate it!

    We have discussed this some, but we don't have a good plan for how to handle it yet. There is some independent work by other teams at Unity on a better general package management system. I think that we might be able to work with nuget and that future feature if/when it is ready. But this is all very early to have any certainty.

    For now, we're left with manually copying assemblies into the Unity project.
     
    Qbit86 likes this.
  3. tuomash

    tuomash

    Unity Technologies

    Joined:
    Apr 5, 2016
    Posts:
    1
    Just wanted to share my highlight of the day: finally official C# gRPC works out-of-the-box (empty project + grpc examples). Great work team!
     
  4. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    I believe there's a bug somewhere that reverts API Compatibility Level back to "Mono 2.0" even though ".Net 4.6" is the only value that is allowed in this preview build.

    A couple of times the compiler stopped compiling my code that relies on .Net 4+ features, just as if I were targeting .Net 3.5. The last time it happened I checked the editor log and saw that the .rsp file, that is generated for the compiler, ended with
    Then I went to the Player Settings to check the current API Compatibility Level, and at the moment I opened these settings in the inspector window, the editor launched the recompilation and it succeeded. Then I checked the editor log again and the recent .rsp file there ended with
    I don't know yet how to reproduce this issue.
     
    Last edited: Feb 4, 2017
  5. Lailore

    Lailore

    Joined:
    Dec 25, 2014
    Posts:
    1
    can't use https://www.nuget.org/packages/IdentityModel/

    TypeLoadException: Error Loading class
    System.RuntimeType.GetMethodsByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.Boolean ignoreCase, System.RuntimeType reflectedType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/ReferenceSources/RuntimeType.cs:481)
    System.RuntimeType.GetMethodCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.CallingConventions callConv, System.Type[] types, System.Boolean allowPrefixLookup) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/rttype.cs:2825)
    System.RuntimeType.GetMethods (System.Reflection.BindingFlags bindingAttr) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/rttype.cs:3078)
    UnityEditor.EditorAssemblies.ProcessStaticMethodAttributes (System.Type type) (at C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:97)
    UnityEditor.EditorAssemblies.ProcessInitializeOnLoadAttributes () (at C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:164)
    UnityEditor.EditorAssemblies:processInitializeOnLoadAttributes()


    Unloading broken assembly Assets/Library/IdentityModel.dll, this assembly can cause crashes in the runtime
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    @alexzzzz

    Thanks for reporting this. It sounds like an ugly one to track down. We will have a look to see if we can find the culprit. If you notice this again, please let us know.
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    @Lailore

    Can you submit a bug report with this project? We would like to take a look at it here. Thanks!
     
  8. CaptainKrishna

    CaptainKrishna

    Joined:
    Jan 4, 2017
    Posts:
    6
    I have a problem with the use of System.Lazy<Interfaces.IAvatarsController> and other system Lazy<T> it show us:

    Error CS0433 the type "Lazy<T>" is in "nunit.framework, Version=3.6.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb" and "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Assembly-CSharp C:\test_projects\Service Client Test\Assets\ServiceClient.cs 30 Aktiv

    which is actually without importing mscorlib or nunit.framework.

    Same is for Error HttpClientHandler CS0433 the type "HttpClientHandler" is in "System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and"System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" . Assembly-CSharp C:\test_projects\Service Client Test\Assets\ServiceClient.cs 14317 Aktiv

    But here it happens after import System.Net.Http via Nuget config directly into the acces folder. Before I import System.Net.Http it says that it couldnt be found. So because of the way of import i am not sure if I causing the Problem for System.Net.Http by myself.

    Btw. Newtonsoft Json seems to work fine after Nuget import. At least the first trys.

    Is there a workaround for the two problems?
     
    rakkarage likes this.
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    @CaptainKrishna

    I don't know of a work around for these issues. Would you mind submitting a bug report (or two) with these projects? It seems there is some sort of conflict that we should investigate.
     
  10. Dizzy-Dalvin

    Dizzy-Dalvin

    Joined:
    Jul 4, 2013
    Posts:
    54
    Yes, I observe the same behaviour. After opening a project it looks as if compiler is set to compile with old .NET profile, thus generating a lot of errors. Then when I open the Player Settings to check the API level, it starts recompiling the project and the errors go away.
    Sadly, this issue doesn't allow me to build the project on our build server from command line using batchmode. I can still build it from the Editor on my own machine, though.

    I tried to create a new repro project, but for some reason it works just fine there.

    I also see the same CL argument in editor log:
    Code (CSharp):
    1. Arguments: "C:\Program Files\Unity 5.6.0b5Mono\Editor\Data\MonoBleedingEdge\lib\mono\4.5\mcs.exe"  @Temp/UnityTempFile-ac8e81f069a0aa1419926477f8382582
    2. index: 89
    3. Responsefile: Temp/UnityTempFile-ac8e81f069a0aa1419926477f8382582 Contents:
    4. -debug
    5. -target:library
    6. -nowarn:0169
    7. -langversion:6
    8. -out:Temp/Assembly-CSharp.dll
    9. -unsafe
    10.  
    11. ...
    12.  
    13. -sdk:2.0
     
  11. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    @Dizzy-Dalvin

    Is it possible for you to provide the original project that causes this issue in a bug report? I wonder if there is something related to an upgrade from an existing project that causes this issue.
     
  12. Dizzy-Dalvin

    Dizzy-Dalvin

    Joined:
    Jul 4, 2013
    Posts:
    54
    Unfortunately it's against our company's policy. Besides, it's really huge. Our project folder is currently about 65 Gb.
    I think I'll try to strip down the project until I get minimal repro case and then report it.
     
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    @Dizzy-Dalvin

    That is fine, I understand. Thanks for trying to track down a repro project. We really appreciate it!
     
  14. Dizzy-Dalvin

    Dizzy-Dalvin

    Joined:
    Jul 4, 2013
    Posts:
    54
    @JoshPeterson

    Okay, this won't be necessary. I think I found the culprit. It's because of the ProjectSettings.asset file.
    It seems when I open the Player Settings tab, Unity switches the API level and changes this line:
    Code (CSharp):
    1.   apiCompatibilityLevelPerPlatform: {}
    to
    Code (CSharp):
    1.   apiCompatibilityLevelPerPlatform:
    2.     Standalone: 3
    And if I save the project, everything works fine afterwards. But since our build machine was checking out the latest commit from git, it was reverting the file back every time. Committing ProjectSettings solved the problem.

    So I guess this is not a bug after all.
     
  15. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    @Dizzy-Dalvin

    Thanks for tracking this down!
     
  16. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    It looks like the bug is indeed related to the project upgrade from previous versions of Unity.

    1. Create a new project in the Mono Upgrade Preview build, put some script that uses Net 4+ features. For example,
    Code (CSharp):
    1. using System.Linq;
    2. using System.Runtime.CompilerServices;
    3. using System.Threading.Tasks;
    4. using UnityEngine;
    5.  
    6. public class Test
    7. {
    8.     [MethodImpl(MethodImplOptions.AggressiveInlining)]
    9.     private void SomeMethod()
    10.     {
    11.         Task.Factory.StartNew(() =>
    12.                               {
    13.                                   var ints = Enumerable.Range(0, 100);
    14.                                   Parallel.ForEach(ints, i => Debug.Log(i));
    15.                               });
    16.     }
    17. }
    2. Reopen this project in Unity 5.6 beta. Open the player settings at least once and save the project.
    3. Reopen the project again in Mono Upgrade Preview build and see the compilation error that "type or namespace Task doesn't exist".
    4. Open the player settings and see how the error disappears during automatic recompilation.
    Repeat steps from 2 to 4 until satisfied.

    Earlier I said that I had run into this problem a couple of times. Now, when I think about it, it's very probable that I opened the same project several times both in 5.6 beta and Mono Upgrade Preview build.
     
    CaptainKrishna likes this.
  17. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    This one can be fixed easily. Open your Unity installation and copy nunit.framework.dll from
    to
    replacing the existing one.

    The second one targets CLR 2.0, which makes sense for regular Unity builds. However, it contains duplicates of several types from CLR 4.0 and for some unknown reason these duplicates are made public.
    clr2.png
     
    Last edited: Feb 6, 2017
    CaptainKrishna and Zuntatos like this.
  18. 2dgame

    2dgame

    Joined:
    Nov 24, 2014
    Posts:
    83
    Are you planning on releasing preview builds more frequently now? Unity 5.6 beta 5 has this annoying bug where Unity crashes every half hour or so and it's ruining all the fun I'm having with with the tasks library ;)
     
  19. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    I was not aware of that bug! We have now been able to get the managed code debugger to work internally, so I suspect we will do another build soon with that plus other fixes.

    We're not ready to commit to a regular cadence yet though.
     
    Vanamerax and 2dgame like this.
  20. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    I keep getting hit by that kMaxCallback bug too.

    @JoshPeterson I know we ask for a lot, but, what about a build based on 5.5? Or is there a technical reason for basing it on the 5.6 beta? It's hard to tell which bugs might be due to the beta and which might be due to the Mono upgrade.
     
  21. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
    @JoshPeterson would be possible to use this on Windows Standalone? Or I'm getting too excited? I'm not saying using WPF or Winforms implementation, I mean the "raw" implementation and then in some way render it to a Unity's Texture.

    https://github.com/cefsharp/CefSharp

    More info:

    https://github.com/cefsharp/CefSharp/wiki/General-Usage

    https://github.com/cefsharp/CefShar...54/CefSharp.Core/ManagedCefBrowserAdapter.cpp

    Now there is no way to implement a Browser in Windows platform (there are some "solutions" on the Asset Store) and when we develop (in our case) apps to videowalls, big multitouch screens, kiosks and so on, we need sometimes this component.
     
    Last edited: Feb 7, 2017
  22. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    @mdrotar

    There is not a technical limitation preventing us from making a 5.5 build. The limitation is more based on time. We will consider doing so though. I can't say yet whether it will happen, but it is possible.
     
    mdrotar likes this.
  23. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    @N3uRo

    I don't see why that would not work, so I think at least it is worth a try.
     
  24. AwDogsGo2Heaven

    AwDogsGo2Heaven

    Joined:
    Jan 17, 2014
    Posts:
    102
    People have been doing things like this in Unreal Engine for a while for user interfaces and other things, and its very popular (surprisingly don't see much talk about it in Unity). If your just doing Windows like you mention you will be fine, but the Chromium Framework is difficult or not supported in many other platforms, so it's limited in use if you plan on doing a mobile or multi-platform game.
     
  25. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    Can someone clarify how to install dotnet packages?
    Copy dll from lib\net46 folder in unzipped nuget?
    That should work for System.Net.Http too?

    I got System.Threading.Tasks working like that but System.Net.Http error:

    edit: I found this explains a bit even if old about how to get nuget config to move packages folder into assets etc http://www.what-could-possibly-go-wrong.com/unity-and-nuget/
    actually that is not a good idea cuz it copys all versions and then complains of dupes

    edit: system.threading.tasks seems to be included by default now... do not need to get it anymore?
     
    Last edited: Mar 8, 2017
  26. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    That should work. We don't have any special integration for nuget, so you will need to copy assemblies from it and use them in the Unity project just as you would use a managed plugin of any kind.
     
    rakkarage likes this.
  27. matrix211v1

    matrix211v1

    Joined:
    Jan 20, 2009
    Posts:
    193
    Can anyone confirm this?
     
  28. stephencoorey

    stephencoorey

    Joined:
    Mar 29, 2017
    Posts:
    10
    I have the hello world example working when running Unity in the IDE, but when I try to build to android or iphone, I get these errors:

    FileNotFoundException: Error loading native library. Not found in any of the possible locations:
    /data/app/com.honeywell.eureka-2/base.apk/assets/bin/Data/Managed/libgrpc_csharp_ext.x86.so,
    /data/app/com.honeywell.eureka-2/base.apk/assets/bin/Data/Managed/runtimes/linux/native/libgrpc_csharp_ext.x86.so,
    /data/app/com.honeywell.eureka-2/base.apk/assets/bin/Data/Managed/../../runtimes/linux/native/libgrpc_csharp_ext.x86.so

    FileNotFoundException: Error loading native library. Not found in any of the possible locations:
    /var/containers/Bundle/Application/FE4FA94A-EB50-41CF-83FB-9BCEAE0DA6A9/eureka.app/libgrpc_csharp_ext.x64.dylib,
    /var/containers/Bundle/Application/FE4FA94A-EB50-41CF-83FB-9BCEAE0DA6A9/eureka.app/runtimes/osx/native/libgrpc_csharp_ext.x64.dylib,
    /var/containers/Bundle/Application/FE4FA94A-EB50-41CF-83FB-9BCEAE0DA6A9/eureka.app/../../runtimes/osx/native/libgrpc_csharp_ext.x64.dylib


    ( i have copied the .so and .dylib files produced by the csharp example into the /assets/plugins/android and
    assets/plugins/iOS folders )


    Edit: Did some further investigation and it looks like the .so and .dylib files produced by Xamarin/Visual Studio for Mac are the native runtime libraries for linux, mac and pc. I can't find anybody who has exposed these runtimes for objective-c or android java builds of grpc. I have built the hello world project in xcode, and this has exposed a lot of .m and .c files, but in order to access the individual classes, i think we need compiled .a or .jar files. Can anybody help me?
     
    Last edited: Jul 5, 2017
  29. Genom

    Genom

    Joined:
    Dec 2, 2014
    Posts:
    86
    Hi, I think an old issue (#737529) regarding GetterAdapterFrame is open again when compiling with .net 4.6 and webgl, does it happens to anyone else?