Search Unity

MissingMethodException for UnityEditor.VersionControl.Provider.Checkout in built dll Unity 2019.1.2f

Discussion in 'Editor & General Support' started by uScript, May 25, 2019.

  1. uScript

    uScript

    Joined:
    Feb 20, 2011
    Posts:
    232
    I have the following code that is used to check if an asset is in source control (Debug.Logs added to try and figure out what's going on):

    Code (CSharp):
    1.    // returns false if path is not in source control or source control is not active
    2.    // optionally, you can check out the file if it is in source control (default behavior is to check out)
    3.    public static bool IsFileInSourceControl(string path, bool checkout = true)
    4.    {
    5.       bool inVC = false;
    6.  
    7.       // blocking checkout of versioned file, if necessary
    8.       Debug.Log("30");
    9.       if (UnityEditor.VersionControl.Provider.isActive)
    10.       {
    11.       Debug.Log("31");
    12.          UnityEditor.VersionControl.Asset asset = UnityEditor.VersionControl.Provider.GetAssetByPath(path.RelativeAssetPath());
    13.       Debug.Log("32");
    14.          if (asset != null)
    15.          {
    16.       Debug.Log("33");
    17.             UnityEditor.VersionControl.Task statusTask = UnityEditor.VersionControl.Provider.Status(asset);
    18.       Debug.Log("34");
    19.             statusTask.Wait();
    20.       Debug.Log("35");
    21.             if (UnityEditor.VersionControl.Provider.CheckoutIsValid(statusTask.assetList[0]))
    22.             {
    23.       Debug.Log("36");
    24.                inVC = true;
    25.       Debug.Log("37");
    26.                if (checkout)
    27.                {
    28.       Debug.Log("38");
    29.                   UnityEditor.VersionControl.Task coTask = UnityEditor.VersionControl.Provider.Checkout(statusTask.assetList[0], UnityEditor.VersionControl.CheckoutMode.Both);
    30.       Debug.Log("39");
    31.                   coTask.Wait();
    32.       Debug.Log("40");
    33.                }
    34.             }
    35.          }
    36.       }
    37.  
    38.       Debug.Log("41");
    39.       return inVC;
    40.    }
    If this code gets executed as loose files in my development project, everything is fine. It fails the first if statement and returns false because I do not have version control support enabled. If I run it when the plugin (uScript) is built into dll form, the function throws a MissingMethodException when immediately entering the function (or at least before the Debug.Log("30"); line because that is not printed out). Upon logging the exception in my exception handler with the following line:

    Debug.Log(e.GetType().ToString() + ": " + e.Message + ": " + e.StackTrace);

    I get the following:

    Code (CSharp):
    1. System.MissingMethodException: UnityEditor.VersionControl.Task UnityEditor.VersionControl.Provider.Checkout(UnityEditor.VersionControl.Asset,UnityEditor.VersionControl.CheckoutMode):   at Detox.ScriptEditor.ScriptEditor.SaveTextFile (System.String path, System.String fileContents) [0x0000c] in <55f14d46cc544231bdbe6d4f9e4abdba>:0
    2. UnityEngine.Debug:Log(Object)
    3. Detox.ScriptEditor.ScriptEditor:SaveTextFile(String, String)
    4. Detox.ScriptEditor.ScriptEditor:Save(String, String, String, Boolean, Boolean, Boolean)
    5. uScript:SaveGraph(ScriptEditor, String, Boolean, Boolean, Boolean, Boolean)
    6. uScript:SaveGraph(Boolean, Boolean, Boolean, Boolean)
    7. uScript:RequestSave(Boolean, Boolean, Boolean, Boolean)
    8. Detox.Editor.GUI.PanelScriptCurrent:DrawToolbarButtons()
    9. Detox.Editor.GUI.PanelScriptCurrent:DrawToolbar(PanelScript)
    10. Detox.Editor.GUI.PanelScriptCurrent:Draw(PanelScript)
    11. Detox.Editor.GUI.PanelScript:Draw()
    12. uScript:DrawGUIBottomAreas()
    13. uScript:DrawMainGUI()
    14. uScript:OnGUI()
    15. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    Anyone know what gives? This code has been tested in previous Unity versions up through at least 2018.2.0f2 and this does not happen.
     
    Last edited: May 26, 2019
  2. LKWD_JamesD

    LKWD_JamesD

    Joined:
    Nov 14, 2016
    Posts:
    2
    I too have this problem. I thought that they might have changed the API but I can't see an issue.