Search Unity

[MacOS Editor] USYM_UPLOAD_AUTH_TOKEN missing on Net 3.5 Framework in Unity 2018.4 LTS

Discussion in 'Unity Cloud Diagnostics' started by LokoSolo, Jul 5, 2021.

  1. LokoSolo

    LokoSolo

    Joined:
    Aug 3, 2018
    Posts:
    4
    For some reason we are still using .Net 3.5 Framework in our Unity 2018.4 project. When we build xcode, the USYM_UPLOAD_AUTH_TOKEN missing error happens again regardless whether we build in batch mode with -username -password flag or in Editor mode.

    NOTE: This issue occurs in .Net 3.5 Framework & MacOS Editor & Cloud Diagnostics Enabled

    Furthermore, we found this exception during build:

    Exception occurred attempting to connect to Unity Performance Reporting service. Native symbols will not be uploaded for this build. Exception details:
    System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a

    This occurs in UnityEditor.CrashReporting.CrashReporting.GetUsymUploadAuthToken(), showing that Unity Editor failed to retrieve the USYM Auth Token from server, causing the xcode project not having the USYM_UPLOAD_AUTH_TOKEN variable.

    After investigation, we believed that the TLS 1.0 certificate for .Net 3.5 Framework that Unity is using has expired or somehow invalid. Given the status that .Net 3.5 is already deprecated by Unity, it is believe that Unity will not fix this.

    Therefore to anyone who comes across with this issue, this is how we fix it with a pre/post build script:
    Code (CSharp):
    1. using System.Net;
    2. using System.Net.Security;
    3. using UnityEditor.Build;
    4. using UnityEditor.Build.Reporting;
    5. using UnityEngine;
    6.  
    7. public class SerivceManagerPreBuildProcess : IPreprocessBuildWithReport {
    8.         public int callbackOrder { get { return int.MinValue + 1; } }
    9.  
    10.         public void OnPreprocessBuild(BuildReport report) {
    11.             if (Application.platform == RuntimePlatform.OSXEditor) {
    12.                 CustomServiceManager.validationCallback = ServicePointManager.ServerCertificateValidationCallback;
    13.                 ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
    14.             }
    15.         }
    16.     }
    17.  
    18.     public class ServiceManagerPostBuildProcess : IPostprocessBuildWithReport {
    19.         public int callbackOrder { get { return int.MaxValue - 1; } }
    20.  
    21.         public void OnPostprocessBuild(BuildReport report) {
    22.             if (Application.platform == RuntimePlatform.OSXEditor) {
    23.                 ServicePointManager.ServerCertificateValidationCallback = CustomServiceManager.validationCallback;
    24.             }
    25.         }
    26.     }
    27.  
    28.     public static class CustomServiceManager {
    29.         public static RemoteCertificateValidationCallback validationCallback;
    30.     }
    Cheers!
     
    Last edited: Sep 16, 2021
    ValeryNikulina likes this.