Search Unity

Bug Not implemented icall: File::DuplicateHandle (webGL/il2cpp)

Discussion in 'Editor & General Support' started by NetworkingServices, Aug 25, 2022.

  1. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    Whenever I try to add my auth in my Unity game I receive multiple errors, the first error being on load, "Not implemented icall: File :: DuplicateHandle", then it provides "at invoke_iiii (webGL.framework.js:3:391519). The second error being "Win32Exception: Success", not really sure what's going on with that one, then lastly when I press my sign in button, I get the first error again.

    Please note this only occurs on webGL and IL2cpp. If I build my game on windows/mono it works 100% without any errors, but as soon as I switch to il2cpp or to webgl I'm given errors. I've been stuck on this for a few days now... any support would be highly appreciated, thank you.
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    I would recommend you try this with full exceptions enabled. See https://docs.unity3d.com/Manual/webgl-debugging.html for some details.

    More generally, duplicating of handles it not support in IL2CPP because it is not possible to support it well on all platforms Unity support.

    The key specific issue here is to determine what code in your project is trying to duplicate handles, and change that code. Hopefully the above debugging tips will help determine that.
     
  3. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    Thank you for your response. So, I checked the documentation and it helped a little but not much. However, I did enable full exceptions and I received the same error "Not implemented icall: File:: DuplicateHandle" however, I did receive another error (image attached) .

    If it helps any, I'm using https://github.com/KeyAuth/KeyAuth-Unity-Example . However, I did remove System Threading and all functions attached to that (can be found in api.cs) and then the func.cs is the same concept, I'm calling KeyAuthApp.init(); on the start function (the init function is in api.cs) ... hopefully you can help me out some more. I'm at a stand still and have no idea how to proceed. Thank you.

    Image showing additional error: https://discord.com/channels/1012188631722639381/1012188631722639383/1012519969600323665
     
  4. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    It's not allowing my auth to initialize... I put KeyAuthApp.init(); then after that I put Debug.Log("error"); (on func.cs) and it showed "error" ... then shows this:

    `

    UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    UnityEngine.Logger:Log(LogType, Object)
    UnityEngine.Debug:Log(Object)
    KeyAuth.api:init()
    Func:loginType()
    UnityEngine.Events.InvokableCall:Invoke()
    UnityEngine.Events.UnityEvent:Invoke()
    UnityEngine.UI.Button:press()
    UnityEngine.UI.Button:OnPointerClick(PointerEventData)
    UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData)
    UnityEngine.EventSystems.EventFunction`1:Invoke(Object, BaseEventData)
    UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    UnityEngine.EventSystems.StandaloneInputModule:ReleaseMouse(PointerEventData, GameObject)
    UnityEngine.EventSystems.StandaloneInputModule:processMousePress(MouseButtonEventData)
    UnityEngine.EventSystems.StandaloneInputModule:processMouseEvent(Int32)
    UnityEngine.EventSystems.StandaloneInputModule:processMouseEvent()
    UnityEngine.EventSystems.StandaloneInputModule:process()
    UnityEngine.EventSystems.EventSystem:Update()
    `
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    I'm not able to access that link. Can you paste the error text (or an image screenshot of the error) directly here in the forums?
     
  6. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    Sorry for the delayed response... so just to make this more clear I'm receiving these errors when building/running my application on webgl and IL2cpp (the application works 100% with mono/windows)

    upload_2022-8-29_0-19-26.png upload_2022-8-29_0-19-44.png

    I'm calling the init function (for my auth, KeyAuth) on my Func.cs class. The init function is in my api class and looks like:
    upload_2022-8-29_0-22-32.png
    upload_2022-8-29_0-22-51.png

    Hopefully this can help you out some because I have no idea why it doesn't work on webgl or il2cpp but works 100% fine with mono/windows build.
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    This works with Mono because Mono implements the DuplicateHandle API call. As I mentioned above, that is not implemented with IL2CPP.

    The problem in the init method above is triggered by the call to Process.GetCurrentProcess().MainModule.FileName. For WebGL, there is no concept of a "current process". So you will want to instead provide some different value for the "hash" key in the values_to_upload dictionary there.
     
  8. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    So I removed the "Process.GetCurrentProcess().MainModule.FileName" ... that was only there for hash/hwid checks but since it's a free game I don't really need it enabled anyways so I disabled it in my auth settings. However, now when I build/run the game on local it loads the Unity splash screen, as well as my splash screen but doesn't load the login scene. I checked the logs and there are no errors. My auth just doesn't want to initialize ... any ideas?
     
  9. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    upload_2022-8-29_20-27-15.png
    This is what I get while the login scene loads.
     
  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    I'm not familiar enough with the way the code in your project works to help, sorry. There are not great debugging options for WebGL. You could use Debug.Log statements, or build the project for Windows standalone player with IL2CPP, where you can enable script debugging.
     
  11. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    If you would like to see the documentation I could upload it? I have all my auth functions in a class called api.cs . Then I have a class called func.cs which I call those functions. As you see in the pictures of the code that I sent above, both of those images are in my api.cs class. From my func.cs class on the start function I do KeyAuthApp.init(); . That's all that I'm doing.

    I also just tried to build/run it in windows IL2CPP and it works 100% fine. The login scene loaded and I was able to login with 0 delay. But again, whenever I try to build/run in webgl it doesn't load the login scene at all.
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    I don't think that documentation could help me too much - I suspect that you will just need to debug the issue. Unfortunately since it works on Windows/IL2CPP, it looks like you will need to use Debug.Log to check the behavior on WebGL.

    Debugging it on Windows first though might be helpful to determine what the expected behavior is. Then you can use Debug.Log statements to validate that behavior on WebGL.
     
  13. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    I have debug log and it still isn't giving me anything useful. Not sure what's going on because it works on everything else except for webgl now.
     
  14. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    WebGL is one of the most restrictive platforms Unity supports, so there may be something else in use that works on other platforms but not on WebGL.

    But I don't have any specific insight into this project, sorry.
     
  15. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    Maybe there is another member of Unity that could take a look at it? I've been trying to set this up for a while now and still no luck...
     
  16. NetworkingServices

    NetworkingServices

    Joined:
    Mar 28, 2022
    Posts:
    20
    upload_2022-9-1_21-48-7.png
    Could it be because I'm using webclient and not UnityWebRequest? ...
     
  17. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    Yes, that might be it. I'm not sure if WebClient works well in WebGL builds. I think UnityWebRequest is supported there.