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
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug StandaloneFileBrowser errors with 'value must be a Com object' after selecting files

Discussion in '2022.1 Beta' started by sumner, Sep 25, 2021.

  1. sumner

    sumner

    Joined:
    Jul 1, 2008
    Posts:
    40
    1. What happened

    Upgraded to 2022 and working SFB code fails with a 'value must be a Com object'



    2. How can we reproduce it using the example you attached?



    var extensions = new[] {

    new ExtensionFilter("Sample Kit Files", "kit", "json" ),

    };



    StandaloneFileBrowser.OpenFilePanelAsync("Load Sample Kit", "", extensions, false, onLoadKitSelected);



    these lines will still open the file browser, but when you select the file, it errors with:



    ArgumentException: Value must be a Com object.

    Parameter name: o

    System.Runtime.InteropServices.Marshal.ReleaseComObject (System.Object o) (at <231f6c5a042647adb84a9cc42c982c35>:0)

    System.Runtime.InteropServices.Marshal.FinalReleaseComObject (System.Object o) (at <231f6c5a042647adb84a9cc42c982c35>:0)

    Ookii.Dialogs.VistaFileDialog.RunFileDialog (System.IntPtr hwndOwner) (at <e3ade0b9a63043c89b5fbc325cc98b60>:0)

    Ookii.Dialogs.VistaFileDialog.RunDialog (System.IntPtr hwndOwner) (at <e3ade0b9a63043c89b5fbc325cc98b60>:0)

    System.Windows.Forms.CommonDialog.ShowDialog (System.Windows.Forms.IWin32Window owner) (at <1d2e5fd5dacd4b00b29699699894aec6>:0)

    (wrapper remoting-invoke-with-check) System.Windows.Forms.CommonDialog.ShowDialog(System.Windows.Forms.IWin32Window)

    SFB.StandaloneFileBrowserWindows.OpenFilePanel (System.String title, System.String directory, SFB.ExtensionFilter[] extensions, System.Boolean multiselect) (at Assets/StandaloneFileBrowser/StandaloneFileBrowserWindows.cs:38)

    SFB.StandaloneFileBrowserWindows.OpenFilePanelAsync (System.String title, System.String directory, SFB.ExtensionFilter[] extensions, System.Boolean multiselect, System.Action`1[T] cb) (at Assets/StandaloneFileBrowser/StandaloneFileBrowserWindows.cs:45)

    SFB.StandaloneFileBrowser.OpenFilePanelAsync (System.String title, System.String directory, SFB.ExtensionFilter[] extensions, System.Boolean multiselect, System.Action`1[T] cb) (at Assets/StandaloneFileBrowser/StandaloneFileBrowser.cs:76)

    HudUI.onLoadKitClicked () (at Assets/Scripts/RhythmGame/HudUI.cs:199)

    UnityEngine.Events.InvokableCall.Invoke () (at <cc54933d6df84ff08e916a4036d0b6c6>:0)

    UnityEngine.Events.UnityEvent.Invoke () (at <cc54933d6df84ff08e916a4036d0b6c6>:0)

    UnityEngine.UI.Button.Press () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:70)

    UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:114)

    UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:57)

    UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272)

    UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)
     
  2. sumner

    sumner

    Joined:
    Jul 1, 2008
    Posts:
    40
    After figuring out it was trying to package up my whole project and that's why the bug report wasn't going thru... I got it submitted as Case 1368392
     
    LeonhardP likes this.
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,132