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 Errors occur on usage of 'async/await' in only editor such as VSCode, VS for mac

Discussion in 'Experimental Scripting Previews' started by zsaladin, Jul 15, 2017.

  1. zsaladin

    zsaladin

    Joined:
    Jan 20, 2015
    Posts:
    11
    I've installed Unity 2017.1.0f3 on my mac and switched Scripting Runtime Version to '.net 4.6'.
    I was excited of using 'Task' class.
    But some errors occurred.
    I used Task.Delay. It worked but the error occurred in only editor(vscode, vs for mac). Even intellisence could not find '.Delay'. Moreover the 'Task' does not have 'GetAwater' in only the editor. So async/await made compile errors in only editor but it worked and there was no error in Unity.

    I went to the declaration and watched assembly information of mscorlib.
    I attached it below.

    [assembly: AssemblyVersion ("4.0.0.0")]
    [assembly: CLSCompliant (true)]
    [assembly: AssemblyCompany ("Mono development team")]
    [assembly: AssemblyCopyright ("(c) Various Mono authors")]
    [assembly: AssemblyDefaultAlias ("mscorlib.dll")]
    [assembly: AssemblyDelaySign (true)]
    [assembly: AssemblyDescription ("mscorlib.dll")]
    [assembly: AssemblyFileVersion ("4.0.30319.1")]
    [assembly: AssemblyInformationalVersion ("4.0.30319.1")]
    [assembly: AssemblyKeyFile ("../ecma.pub")]
    [assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
    [assembly: AssemblyTitle ("mscorlib.dll")]
    [assembly: NeutralResourcesLanguage ("en-US")]
    [assembly: SatelliteContractVersion ("4.0.0.0")]
    [assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
    [assembly: DefaultDependency (LoadHint.Always)]
    [assembly: InternalsVisibleTo ("System.Core, PublicKey=00000000000000000400000000000000")]
    [assembly: InternalsVisibleTo ("System, PublicKey=00000000000000000400000000000000")]
    [assembly: ReferenceAssembly]
    [assembly: RuntimeCompatibility (WrapNonExceptionThrows = true)]
    [assembly: StringFreezing]
    [assembly: ComCompatibleVersion (1, 0, 3300, 0)]
    [assembly: ComVisible (false)]
    [assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")]
    [assembly: TypeLibVersion (2, 4)]
    [assembly: AllowPartiallyTrustedCallers]
    [assembly: SecurityPermission (SecurityAction.RequestMinimum, SkipVerification = true)]
    [module: UnverifiableCode]


    And I created new normal c# project(it's not Unity project).
    There was no error using Task.Delay and async/await.
    I found the differences that 'AssemblyFileVersion' and 'AssemblyInformationversion" of its mscorlib is "4.6.57.0".
    I attached it below.

    [assembly: AssemblyVersion ("4.0.0.0")]
    [assembly: CLSCompliant (true)]
    [assembly: Debuggable (DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
    [assembly: AssemblyCompany ("Mono development team")]
    [assembly: AssemblyCopyright ("(c) Various Mono authors")]
    [assembly: AssemblyDefaultAlias ("mscorlib.dll")]
    [assembly: AssemblyDescription ("mscorlib.dll")]
    [assembly: AssemblyFileVersion ("4.6.57.0")]
    [assembly: AssemblyInformationalVersion ("4.6.57.0")]
    [assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
    [assembly: AssemblyTitle ("mscorlib.dll")]
    [assembly: NeutralResourcesLanguage ("en-US")]
    [assembly: SatelliteContractVersion ("4.0.0.0")]
    [assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
    [assembly: DefaultDependency (LoadHint.Always)]
    [assembly: InternalsVisibleTo ("System, PublicKey=00000000000000000400000000000000")]
    [assembly: InternalsVisibleTo ("System.Core, PublicKey=00000000000000000400000000000000")]
    [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")]
    [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000")]
    [assembly: ReferenceAssembly]
    [assembly: RuntimeCompatibility (WrapNonExceptionThrows = true)]
    [assembly: StringFreezing]
    [assembly: ComCompatibleVersion (1, 0, 3300, 0)]
    [assembly: ComVisible (false)]
    [assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")]
    [assembly: AllowPartiallyTrustedCallers]
    [assembly: SecurityPermission (SecurityAction.RequestMinimum, SkipVerification = true)]
    [assembly: SecurityPermission (SecurityAction.RequestMinimum, SkipVerification = true)]
    [module: UnverifiableCode]


    But I don't know how I can fix it.
    Could you help me please?

    I'm using VSCode and VS for mac on mac.
     
  2. zsaladin

    zsaladin

    Joined:
    Jan 20, 2015
    Posts:
    11
    It seems I found the clues.
    The generated .csproj files indicates 4.0 dlls like below.

    <Reference Include="mscorlib">
    <HintPath>/Applications/Unity/Unity.app/Contents/MonoBleedingEdge/lib/mono/4.0/mscorlib.dll</HintPath>
    </Reference>
    <Reference Include="System">
    <HintPath>/Applications/Unity/Unity.app/Contents/MonoBleedingEdge/lib/mono/4.0/System.dll</HintPath>
    </Reference>
    <Reference Include="System.XML">
    <HintPath>/Applications/Unity/Unity.app/Contents/MonoBleedingEdge/lib/mono/4.0/System.XML.dll</HintPath>
    </Reference>
    <Reference Include="System.Core">
    <HintPath>/Applications/Unity/Unity.app/Contents/MonoBleedingEdge/lib/mono/4.0/System.Core.dll</HintPath>
    </Reference>
    <Reference Include="System.Runtime.Serialization">
    <HintPath>/Applications/Unity/Unity.app/Contents/MonoBleedingEdge/lib/mono/4.0/System.Runtime.Serialization.dll</HintPath>
    </Reference>

    So I fixed it to 4.5 then intellisence works well.
    I think unity engineers should check the sources located in 'UnityEditor/UnityEditor.VisualStudioIntegration/SolutionSynchronizer.cs' in UnityEditor.dll
    It creates the solution files including <HintPath>.
     
    Last edited: Jul 16, 2017
  3. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    I'm not sure about VSCode integration, but certainly the latest version of Visual Studio for Mac should work out of the box. If not, can you submit a bug report? We need to correct this if it is not working.
     
  4. zsaladin

    zsaladin

    Joined:
    Jan 20, 2015
    Posts:
    11
    Okay, I reported the problem. It was assigned to Case 932658.
    I hope it can help you fix the problem.
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
  6. lluo

    lluo

    Joined:
    May 19, 2016
    Posts:
    20
    Just wanted to confirm that I've got the same behavior as the OP described. had to manually change the hint path "4.0" to "4.5" to temporarily fix the issue