Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

[Released] Roslyn C# - Runtime C# compiler

Discussion in 'Assets and Asset Store' started by scottyboy805, Mar 27, 2019.

  1. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    We will be submitting an update later today if all goes well but in the meantime feel free to send us an email to info(at)trivialinteractive.co.uk if you need a patch update asap.
     
  2. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Roslyn C# version 1.2.2 has been submitted to the asset store for review. This update fixes a bug where PDB symbols would not be generated in some cases. We have also added a number of methods to the ScriptType class for dealing with custom attributes.
     
  3. Crazycarpet

    Crazycarpet

    Joined:
    Dec 5, 2015
    Posts:
    37
    Is there a way to have Roslyn compile the code, generate the Assembly but not actually load it?
     
  4. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    Yes you can tell the compiler not to load compiled assemblies by disabling the following setting:

    Code (CSharp):
    1. RoslynCSharpCompiler.loadCompiledAssemblies = false;
    Note that this is a global setting and will affect all compile requests.
     
  5. Crazycarpet

    Crazycarpet

    Joined:
    Dec 5, 2015
    Posts:
    37
    Thanks for the reply! I tried this in my project and unfortunately it doesn't seem to work. Whenever I set loadCompiledAssemblies to false ScriptDomain.CompileAndLoadFiles(...) returns null with no error. Also, compiling the exact same files works when loadCompiledAssemblies is true.

    Is this possibly a bug, or the intended behavior when loadCompiledAssemblies is set to false?
     
  6. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    This is intended behaviour because the return result of that method (ScriptAssembly) represents an assembly which has been loaded into memory. With 'loadCompiledAssemblies' disabled, the assembly is never loaded so that method can only return null. You can still access the non-loaded assembly information like filepath and raw assembly image data via the script domain compilation result:

    Code (CSharp):
    1. CompilationResult result = scriptDomain.CompileResult;
    Let me know if you have any more questions.
     
  7. Crazycarpet

    Crazycarpet

    Joined:
    Dec 5, 2015
    Posts:
    37
    Ok, I now have this:
    Code (CSharp):
    1. RoslynCSharpCompiler.loadCompiledAssemblies = false; // Temporarily prevent Roslyn from loading compiled assemblies.
    2. domain.CompileAndLoadFiles(scriptPaths.ToArray(), ScriptSecurityMode.UseSettings);
    3. foreach (CompilationError error in domain.CompileResult.Errors)
    4. {
    5.     if (error.IsError)
    6.     {
    7.         LogHelper.LogError("SCRIPT ERROR : " + error.ToString());
    8.     }
    9.     else if (error.IsWarning)
    10.     {
    11.         LogHelper.LogWarning("SCRIPT WARNING : " + error.ToString());
    12.     }
    13. }
    14.  
    15. CompilerResult result = new CompilerResult(){ succeeded = domain.CompileResult.Success, assembly = domain.CompileResult.OutputAssembly };
    16. RoslynCSharpCompiler.loadCompiledAssemblies = true;     // Re-enable Roslyn to load compiled assemblies.
    however even after compilation is successful domain.CompileResult.OutputAssembly is null. Is this also intended or am I doing something wrong?
    My end goal is to send this Assembly from a server to a client. I realize I can send the raw source and have the client compile it but I would like to try it this way first if possible.

    Sorry for all the questions, I really appreciate the great asset and support.

    Edit: I'm assuming OutputAssembly is also only in for assemblies loaded into memory, I'm going to send the OutputAssemblyImage data to the client instead.
    Edit2: Seems to be working now, I was just misunderstanding what Assembly and ScriptAssembly are.. clearly they only exist for loaded assemblies. Thank you.
     
    Last edited: Mar 1, 2020
  8. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Yes that property should also be null in this situation because it returns a 'System.Reflection.Assembly' instance which in this case has not been loaded due to disabling 'loadCompiledAssemblies'. You will need to use either 'OutputPath' or 'OutputAssemblyImage' properties of the compilation result. The 'OutputPath' property will contain the full path to the generated assembly if 'Generate In Memory' is set to false in the Roslyn C# settings window. If this setting is true then the path property will be null. The 'OutputAssemblyImage' property will return a byte array containing the raw assembly image data which could be passed direction to 'System.Reflection.Assembly.Load'. This property will always be initialized with the assembly data and you could send this byte[] data to another client and load it on the other side.
     
  9. Crazycarpet

    Crazycarpet

    Joined:
    Dec 5, 2015
    Posts:
    37
    Thanks again your explanation clears everything up
    This exactly what I'm doing now and it seems to work perfectly.
     
  10. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Glad you got it working. Let me know if you have anymore issues or questions.
     
  11. mm_ASH

    mm_ASH

    Joined:
    Nov 15, 2013
    Posts:
    358
    Hi scottyboy805! Seems you need to update some DLLs for Unity 2019.3. Reproducing steps:
    1. Create new HDRP-based project
    2. Import Roslyn C# - Runtime Compiler asset bundle
    3. I am getting assembly references conflict for HDRP and Roslyn C# - Runtime Compiler

     
    Last edited: Mar 9, 2020
  12. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    This is a known issue and not something we can definitivley fix due to supporting older Unity versions. You just need to delete the 'System.ValueTuple.dll' assembly from the 'Assets/RoslynCSharp/Plugin/' folder. There is more detailed information about this in the user guide under the 'Plugin Conflicts' section.
    I hope this helps you.
     
    mm_ASH likes this.
  13. mm_ASH

    mm_ASH

    Joined:
    Nov 15, 2013
    Posts:
    358
    Thanks a lot!
     
  14. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Rolsyn C# version 1.2.3 has been submitted to the asset store. This version changes the 'OutputPath' property of the compiler to 'OutputDirectory' to be used in conjunction with 'OutputName' in order to make it more intuitive when saving assemblies to different locations.
     
  15. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    Hey great work on this so far, I just have a couple of questions :

    I'm having a problem loading a dll when the security settings are enabled, but the script inside the dll doesn't break any rules, I have the same script as a single C# file and that loads fine, but when I compile it using rider it fails to load in when security is on. Is there anything else that might cause this? The script just looks like this :

    Code (CSharp):
    1. using ICModding;
    2. using UnityEngine;
    3.  
    4. namespace ICModdingTest {
    5.     public class Class1 : ICMod {
    6.  
    7.         public Class1() {
    8.             Debug.Log("Helloo this is from a compiled dll");
    9.         }
    10.      
    11.         public void Update() {
    12.             Debug.Log("Spamming out those updates from a compiled plugin : " + Time.time);
    13.         }
    14.     }
    15. }
    16.  
    The other thing I was wondering, is it possible to unload scripts / assemblies completely during runtime and reload them? I tried the Dispose method in ScriptDomain class but that throw s this error
    Code (CSharp):
    1. ThreadAbortException
    2. System.AppDomain.Unload (System.AppDomain domain) (at <437ba245d8404784b9fbab9b439ac908>:0)
    3. RoslynCSharp.ScriptDomain.Dispose () (at Assets/RoslynCSharp/Scripts/Runtime/ScriptDomain.cs:719)
    then unity starts acting strangely...
    Could this be achieved with an App Domain? I noticed you have an app domain parameter when creating the script domain but my experiments haven't got me anywhere so far...

    Thanks for the help
     
  16. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    Are the security errors you are getting related to System.Reflection? If so then it is likley the auto-generated AssemblyInfo.cs file causing the security problem. You will find the source file in the project under the 'Properties' foldout and it references some namespaces which are disallowed by the default security settings. To get around this you can remove/comment out the offending source code or relax the security restrictions by removing the System.Relfection namespace limitation.

    It is possible to unload script assemblies using a separate AppDomain however setting up another AppDomain to work with Unity is one of the most difficult and finicky things we have ever tested so I would not recommend it. We did manage to get a really bare bones assembly loaded into a separate AppDomain but it required so much work, debugging and head scratching that we elected not to officially support it.

    The Dispose method of ScriptDomain should not be unloading the AppDomain and causing those issues unless you are using a separate AppDomain passed via the constructor. If you did not pass a separate AppDomain when creating the script dfomain then it sounds like a bug and we will have to look into it.
     
  17. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    I tried removing the reflection namespace from the blacklist still not loading with security turned on. The error message is
    Code (CSharp):
    1. ObjectDisposedException: Cannot access a disposed object.
    2. Object name: 'Stream has been closed'.
    3. System.IO.FileStream.get_Position () (at <437ba245d8404784b9fbab9b439ac908>:0)
    4. Trivial.Mono.Cecil.PE.BinaryStreamReader.get_Position () (at <3e61e451ed164d38a18870f539d71f9c>:0)
    5. Trivial.Mono.Cecil.Cil.CodeReader.MoveTo (Trivial.Mono.Cecil.MethodDefinition method) (at <3e61e451ed164d38a18870f539d71f9c>:0)
    6. Trivial.Mono.Cecil.Cil.CodeReader.ReadMethodBody (Trivial.Mono.Cecil.MethodDefinition method) (at <3e61e451ed164d38a18870f539d71f9c>:0)
    7. Trivial.Mono.Cecil.MetadataReader.ReadMethodBody (Trivial.Mono.Cecil.MethodDefinition method) (at <3e61e451ed164d38a18870f539d71f9c>:0)
    8. Trivial.Mono.Cecil.MethodDefinition+<>c.<get_Body>b__40_0 (Trivial.Mono.Cecil.MethodDefinition method, Trivial.Mono.Cecil.MetadataReader reader) (at <3e61e451ed164d38a18870f539d71f9c>:0)
    9. Trivial.Mono.Cecil.ModuleDefinition.Read[TItem,TRet] (TRet& variable, TItem item, System.Func`3[T1,T2,TResult] read) (at <3e61e451ed164d38a18870f539d71f9c>:0)
    10. Trivial.Mono.Cecil.MethodDefinition.get_Body () (at <3e61e451ed164d38a18870f539d71f9c>:0)
    11. Trivial.CodeSecurity.CodeEvaluation.MethodChecker.SecurityCheckCode (Trivial.CodeSecurity.CodeSecurityContext context, Trivial.Mono.Cecil.MethodDefinition methodDefinition) (at <484a64e5278b425caef05c2019a179ff>:0)
    12. Trivial.CodeSecurity.CodeEvaluation.TypeChecker.SecurityCheckCode (Trivial.CodeSecurity.CodeSecurityContext context, Trivial.Mono.Cecil.TypeDefinition typeDefinition) (at <484a64e5278b425caef05c2019a179ff>:0)
    13. Trivial.CodeSecurity.CodeEvaluation.ModuleChecker.SecurityCheckModuleCode (Trivial.CodeSecurity.CodeSecurityContext context, Trivial.Mono.Cecil.ModuleDefinition module) (at <484a64e5278b425caef05c2019a179ff>:0)
    14. Trivial.CodeSecurity.CodeSecurityEngine.SecurityCheckAssembly (Trivial.CodeSecurity.ICodeSecurityValidator validator, Trivial.CodeSecurity.CodeSecurityReport& report) (at <484a64e5278b425caef05c2019a179ff>:0)
    15. Trivial.CodeSecurity.CodeSecurityEngine.SecurityCheckAssembly (Trivial.CodeSecurity.CodeSecurityRestrictions restrictions, Trivial.CodeSecurity.CodeSecurityReport& report) (at <484a64e5278b425caef05c2019a179ff>:0)
    16. RoslynCSharp.ScriptAssembly.SecurityCheckAssembly (Trivial.CodeSecurity.CodeSecurityRestrictions restrictions, Trivial.CodeSecurity.CodeSecurityReport& report) (at Assets/RoslynCSharp/Scripts/Runtime/ScriptAssembly.cs:195)
    17. RoslynCSharp.ScriptDomain.RegisterAssembly (System.Reflection.Assembly assembly, RoslynCSharp.ScriptSecurityMode securityMode, Trivial.CodeSecurity.CodeSecurityEngine securityEngine, System.Boolean isRuntimeCompiled, RoslynCSharp.Compiler.CompilationResult compileResult) (at Assets/RoslynCSharp/Scripts/Runtime/ScriptDomain.cs:867)
    18. RoslynCSharp.ScriptDomain.LoadAssembly (System.String fullPath, RoslynCSharp.ScriptSecurityMode securityMode) (at Assets/RoslynCSharp/Scripts/Runtime/ScriptDomain.cs:301)
    19. ModLoader.LoadAllMods () (at Assets/Scripts/Modding/ModLoader.cs:40)
    20. ModLoader.Start () (at Assets/Scripts/Modding/ModLoader.cs:16)
     
  18. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    It looks like a bug and I believe we have now fixed an issue which could have caused this error. We will be submitting an update to the asset store shortly but if you need the update asap then send us an email to info(at)trivialinteractive.co.uk with your invoice number and we can send your the update direct.
     
  19. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Roslyn c# 1.2.4 has been submitted to the asset store. This version fixes a bug where assemblies loaded by file path could cause stream disposed excpetions when running code security verification checks.
     
  20. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    Hey scottyboy805, thanks for the info on the update :) I am not in any hurry and will just keep security features turned off for now I still have a long way to go before I can utilize this in a real environment this is just my curiosity and some noodling atm :) glad to hear there's a fix on the way
     
    scottyboy805 likes this.
  21. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Roslyn C# 1.2.5 has been submitted to the asset store. This version fixes an issue where incorrect strong named reference assemblies could cause errors on import in some versions of Unity.
     
  22. Tracecat

    Tracecat

    Joined:
    Mar 20, 2014
    Posts:
    22
    Hello again! Is there way to create instances of nested types. For example, inner classes. C# provides a Type.GetNestedTypes() method for this but I cannot find anything similar in the ScriptType or
    ScriptProxy classes...
     
  23. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    We don't have anything like that for nested types at the moment but it is certainly something we can add to the next update. In the meantime you would have to access the system type via the 'RawType' property for nested types.
     
  24. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Roslyn C# 1.3.0 has been submitted to the asset store and should be available shortly. This version adds API's for working with nested types as requested:
    • Added property 'ScriptType.Parent' which will return the declaring type if the type is nested.
    • Added property 'ScriptType.IsNestedType' which will return true if the type is declared within another type.
    • Added property 'ScriptType.NestedTypes' which will return an array of nested script types or an empty array if no nested types are defined.
    • Added property 'ScriptType.HasNestedTypes' which will return true if the type has one or more nested types.
    • Added method 'ScriptType.FIndNestedType(string)' which will attempt to search for the nested type with the specified name.
    • Added method 'ScriptType.FindNestedTypeFullName(string)' which will attempt to search for the nested type via its full name. This is like searching for the type via its declaration path. For example 'MyCustomType+MyNestedType'. The search string uses the '+' character as the nested type separator as per standard C# reflection.
    • Modified all 'ScriptAssembly.Find...' methods to accept an extra optional parameter 'findNestedTypes'. This option can be used to filter the search between root types only or all types.
    • Modified all 'ScriptAssembly.Enumerate...' methods to accept an extra optional parameter 'enumerateNestedTypes'. This option can be used to filter the search between root types only or all types.
     
    vvander likes this.
  25. vvander

    vvander

    Joined:
    Jan 18, 2011
    Posts:
    72
    Hello, I just updated to the most recent version of this plugin and compilation no longer completes. I'm receiving this warning + error now:

    warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.

    error CS0518: Predefined type 'System.Object' is not defined or imported


    @scottyboy805 any idea what's going on?
     
  26. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    Could you let me know which Unity version you are using and we will look into it. Also are you adding a reference to 'mscorlib' or 'netstandard' depending upon the framework you are using? A few versions ago we eliminated the default references from being added automatiallc as it could cause issues in some cases so now those references should be added via code or via the settings window manually. The 'MazeCrawlerExample.cs' script shows how to add these references.
     
    vvander likes this.
  27. vvander

    vvander

    Joined:
    Jan 18, 2011
    Posts:
    72
    Thanks for the quick reply @scottyboy805!

    I'm using Unity 2019.3.1f1.

    Just tried adding both 'mscorelib' and 'netstandard' via the settings window, but it seems neither one will work. Now I'm receiving this error instead:


    ArgumentException: Failed to resolve assembly reference 'netstandard'. Ensure that the assembly is loaded and that the specified name is correct
    RoslynCSharp.Compiler.AssemblyReference..ctor (System.String assemblyName, System.AppDomain domain)


    Here's what my RoslynCSharpSettings looks like (WTSData, MSCI, Utilities, and WTSUtilities are my game's assemblies):


    I can try adding these references via code, but there's a sizable abstraction layer we've built in on top of your plugin, so it'll take a bit more time to attempt that.
     
  28. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    'mscorlib' is incorrectly spelt in the inspector window you show so that wont help. I would also suggest trying to add the '.dll. extension to the reference too as we found that it was required for some of the system dll's. The name you want is 'mscorlib.dll', no 'e'.
     
    vvander likes this.
  29. vvander

    vvander

    Joined:
    Jan 18, 2011
    Posts:
    72
    Ah good catch!! Just one wrong letter and everything goes haywire. Looks like that fixed the issue. Thanks for your help!
     
    scottyboy805 likes this.
  30. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    No problem. Glad to hear the problem is sorted. We will add a section to the documentation about setting up default references.
     
    vvander likes this.
  31. Sterner

    Sterner

    Joined:
    Nov 11, 2012
    Posts:
    32
    Hi

    Writing quite complex systems with Roslyn C# is amazing, but the ability to debug or at least to see a line where the exception happened would be amazing!

    PS: I've enabled Generate Symbols and disabled Optimize Code and I'm still not seeing exception lines :(
     
  32. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    Yes being able to debug would be awesome, however we have not yet been able to get runtime debugging setup with Unity and visual studio due to portable pdb symbol files. They never seem to be detected or loaded as expected and it could be due to mono or something else that we havent figured out yet.. We have had a user get runtime debugging working using Jetbrains Rider IDE so that may be something to consider, although we would not be able to offer much help with that.
     
  33. Sterner

    Sterner

    Joined:
    Nov 11, 2012
    Posts:
    32
    Thanks for a quick response!

    Maybe there is a way to get a better understanding of where exception actually happened? Currently, if I have an exception the only one thing I see is a method where it happened, but not a line
     
  34. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Without the pdb symbols file, you won't be able to get an exact line number. The best you could do at the moment would be to compile from file if possible and then you will atleast get the file name in the error message.
     
  35. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    636
    Any news on IL2CPP builds yet?
     
  36. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    We have hit a bit of a wall with IL2CPP and we have also not had much time to dedicate to it at the moment. It is still something we could potetnailly support but it will not be anytime soon since it requires a lot of research and testing.
     
    Kearavain likes this.
  37. alvaro_unity903

    alvaro_unity903

    Joined:
    Jan 20, 2020
    Posts:
    21
    Hi @scottyboy805 , I'm having the same 3 errors but I haven't that RoslynCShapr directories. I made a search and I have nothing similar. I'm upgrading a Unity project with ML-Agents 0.4b to the last 1.0, and also with the last Unity 2019.3.12f1.
     
  38. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    I just tested in 2019.3.12 and the asset is imported to 'Assets/RoslynCSharp' for me. All I could suggest is to try looking under the 'Packages' folder to see if it got imported there since the package manager is now used to import assets from the store. If not, then maybe try re-importing from the store again to see if anything changes.
     
  39. Crazycarpet

    Crazycarpet

    Joined:
    Dec 5, 2015
    Posts:
    37
    Hey, so this has been working great for me except I updated the asset and now
    Code (CSharp):
    1. IEnumerable<ScriptType> types = clientsideScriptAssembly.EnumerateAllSubTypesOf<Gamemode>();
    2. if (types.Any())
    always returns false, I haven't changed anything else just clicked "Update" and updated the RoslynC# asset... before I get into debugging this I was wondering if 1.3.x has any breaking changes you know of that might shorten my debugging time...? It worked on 1.2.1

    I have Roslyn execute a 'main' function from the file so I know it is compiling and running the file however it's failing to find the classes that derive from "Gamemode" in the assembly. (They are there)

    Edit: I have all the neccesary dlls referenced in settings too, no error messages, just EnumerateAllSubTypesOf is now returning an empty list every time.
     
    Last edited: May 5, 2020
  40. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    Thanks for reporting this issue.
    We have looked into it and it looks like a logic bug was introduced in the update causing only nested types to be returned. We have now fixed this and will be submitting an update to the asset store shortly. If you need the update right away then send us an email to info(at)trivialinteractive.co.uk with your invoice number and we can send you the update direct as verification can take a couple of days.
     
  41. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Roslyn C# version 1.3.1 has been submitted to the asset store. As above, this version fixes logic errors introduced in the previous version relating to the FindSubTypeOf, EnumeratAllTypes, EnumerateSubTypes, etc. methods which could cause types to not be returned as expected.
     
    Crazycarpet likes this.
  42. Crazycarpet

    Crazycarpet

    Joined:
    Dec 5, 2015
    Posts:
    37
    Ah okay thanks, I'll keep an eye out. As always, I appreciate the quick support.
     
  43. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    636
    It's a day 1 buy for me if you can get IL2CPP working. Anyone can get c# compiling at runtime, but getting it compatible with il2cpp builds would make this purchase worth it.
     
  44. alvaro_unity903

    alvaro_unity903

    Joined:
    Jan 20, 2020
    Posts:
    21
    I haven't anything but a 'manifest.json' in the 'Packages' folder. I downloaded the roslyn-master from GitHub (in the store it have a price) and unzip inside. I still have these errors.

    I tried changing the name of the folder to 'RoslynCSharp' and errors doesn't disappear. I put it inside 'Assets' as you said that your Editor did and I get thousands of errors more.
     
  45. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    The Roslyn master you mention on github is not our asset which is why you will not see the necessary files. I cannot help you if you are not using our asset from the asset store sorry.
     
  46. alvaro_unity903

    alvaro_unity903

    Joined:
    Jan 20, 2020
    Posts:
    21
    Before all, I want to say that I'm a newbie with Unity and junior as a coder.

    I purchased and seemed like I solved those three problems, but not. After that, I got other errors as PrecompiledAssemblyException> Multiple precompiled assemblies with the same name System.ValueTuple.dll included or the current platform.

    I tried deleting the duplicated files, one each time, with no success.

    Unity is all time importing Roslyn and throwing errors I have to close from task manager. After the restart, I get the first problems, but when I try to interact with Unity, it starts again the importing iterations.

    One question, I didn't find the three first errors on all the internet except here, I need Roslyn to solve it? I think that Unity or this project should have its own compiler. I'm really lost.
     
  47. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    Hi,
    Did you delete the Roslyn C# version of 'System.ValueTuple.dll' located in the 'Assest/Roslyn C#/Plugin/' folder as per the user guide because that should fix those issues? If you are still having those errors could you let me know which Unity version you are using and which packages if any. Adding the package json manifest file would be useful if you are able to.
     
  48. alvaro_unity903

    alvaro_unity903

    Joined:
    Jan 20, 2020
    Posts:
    21
    Yes, I deleted and then I got more errors like:

    Failed to extract C2 class of base type C1 when inspecting Assets/RoslynCSharp/src/Compilers/Test/Resources/Core/SymbolsTests/CyclicInheritance/Class2.dll
    UnityEditor.AssemblyHelper:ExtractAllClassesThatAreUserExtendedScripts(String, String[]&, String[]&, String[]&)

    And more that I can´t expand because the iterative importations of Roslyn.

    I´m using Unity 2019.3.13f1 Personal.
    The manifest:
    {
    "dependencies": {
    "com.unity.collab-proxy": "1.2.16",
    "com.unity.ide.rider": "1.1.4",
    "com.unity.ide.vscode": "1.2.0",
    "com.unity.test-framework": "1.1.13",
    "com.unity.textmeshpro": "2.0.1",
    "com.unity.timeline": "1.2.14",
    "com.unity.ugui": "1.0.0",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
    }
    }
     
  49. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,101
    That folder that you show is not part of our asset which makes me think you are not using our Rolsyn C# asset from the asset store here. I guess you are just using the Roslyn compiler binaries or source which take a bit of work to get working with Unity. If you are not using our asset then I cannot offer any help as this is a dedicated asset support thread for our paid asset.
     
  50. alvaro_unity903

    alvaro_unity903

    Joined:
    Jan 20, 2020
    Posts:
    21
    Probably you are right and I forgot to delete the other Roslyn before import yours. I deleted and imported again.

    However, after delete de System.ValueTuple.dll as you said before to solve those 4 errors ( https://forum.unity.com/threads/released-roslyn-c-runtime-c-compiler.651505/page-2#post-5345328 ), I still have it, even after save and restart.