Search Unity

Bug IL2CPP GenericSharingVisitor.Process - NotImplementedException

Discussion in 'Windows' started by stonstad, Dec 15, 2022.

  1. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    I'm using LTS 2021.3.15f1. Also happens on 3.14f1. I'm getting NotImplementedException - The method or operation is not implemented from IL2CPP GenericSharingVisitor. The call site for the exception changes each time I attempt a build. The exception is thrown from both user code and Unity package code.

    Unity Bug Portal IN-25812

    I'm unable to create builds of my game. Is there a known workaround?

    2021.3.15f1\Editor\Data\il2cpp\build\deploy\il2cpp.exe @Library\Bee\artifacts\rsp\4115519617908147460.rsp
    Error: IL2CPP error for type 'UnityEngine.XR.InputDeviceCharacteristics' in assembly
    'C:\Source\Library\Bee\artifacts\WinPlayerBuildProgram\ManagedStripped\UnityEngine.XRModule.dll'
    System.NotImplementedException: The method or operation is not implemented.
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.Process(Instruction instruction, MethodDefinition method, Boolean fullGenericSharing)
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Do you happen to have the full call stack from IL2CPP available?
     
  3. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Build Attempt #1

    C:\Program Files\Unity\Hub\Editor\2021.3.15f1\Editor\Data\il2cpp\build\deploy\il2cpp.exe @Library\Bee\artifacts\rsp\4115519617908147460.rsp
    Error: IL2CPP error for method 'System.String CI.HttpClient.Helpers.AuthHelper::CreateOAuth2Header(System.String)' in C:/Source/XXX/XXX/Assets/Plugins/HttpClient/Helpers/AuthHelper.cs:24
    System.NotImplementedException: The method or operation is not implemented.
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.Process(Instruction instruction, MethodDefinition method, Boolean fullGenericSharing)
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.ProcessType(TypeDefinition type)
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.Collect(AssemblyDefinition assembly)
    at Unity.IL2CPP.AssemblyConversion.PrimaryCollection.Steps.Global.GenericSharingAnalysis.ProcessItem(GlobalPrimaryCollectionContext context, AssemblyDefinition item)
    at Unity.IL2CPP.AssemblyConversion.Steps.Base.ScheduledItemsStepFuncWithContinueFunc`4.WorkerWrapper(WorkItemData`3 workerData)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.ContinueWithResultsWorkItem`4.InvokeWorker(Object context, Int32 uniqueId)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.BaseContinueWorkItem`2.Invoke(Object context, Int32 uniqueId)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.WorkerLoop(Object data)



    AuthHelper.cs Line 24
    public static string CreateOAuth2Header(string token)
    {
    return "Bearer " + token; // line 24
    }
     
  4. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Build Attempt #2


    C:\Program Files\Unity\Hub\Editor\2021.3.15f1\Editor\Data\il2cpp\build\deploy\il2cpp.exe @Library\Bee\artifacts\rsp\4115519617908147460.rsp
    Error: IL2CPP error for method 'Steamworks.Data.SNetSocket_t Steamworks.ISteamNetworking::CreateP2PConnectionSocket(Steamworks.SteamId,System.Int32,System.Int32,System.Boolean)' in assembly 'C:\Source\XXX\XXX\Library\Bee\artifacts\WinPlayerBuildProgram\ManagedStripped\Facepunch.Steamworks.Win64.dll'
    System.NotImplementedException: The method or operation is not implemented.
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.Process(Instruction instruction, MethodDefinition method, Boolean fullGenericSharing)
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.ProcessType(TypeDefinition type)
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.Collect(AssemblyDefinition assembly)
    at Unity.IL2CPP.AssemblyConversion.PrimaryCollection.Steps.Global.GenericSharingAnalysis.ProcessItem(GlobalPrimaryCollectionContext context, AssemblyDefinition item)
    at Unity.IL2CPP.AssemblyConversion.Steps.Base.ScheduledItemsStepFuncWithContinueFunc`4.WorkerWrapper(WorkItemData`3 workerData)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.ContinueWithResultsWorkItem`4.InvokeWorker(Object context, Int32 uniqueId)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.BaseContinueWorkItem`2.Invoke(Object context, Int32 uniqueId)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.WorkerLoop(Object data)
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
     
  5. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Build Attempt #3


    C:\Program Files\Unity\Hub\Editor\2021.3.15f1\Editor\Data\il2cpp\build\deploy\il2cpp.exe @Library\Bee\artifacts\rsp\4115519617908147460.rsp
    Error: IL2CPP error for method 'System.Void Newtonsoft.Json.Utilities.DynamicProxy`1::.ctor()' in /root/repo/Src/Newtonsoft.Json/Utilities/DynamicProxy.cs:36
    System.NotImplementedException: The method or operation is not implemented.
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.Process(Instruction instruction, MethodDefinition method, Boolean fullGenericSharing)
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.ProcessType(TypeDefinition type)
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.Collect(AssemblyDefinition assembly)
    at Unity.IL2CPP.AssemblyConversion.PrimaryCollection.Steps.Global.GenericSharingAnalysis.ProcessItem(GlobalPrimaryCollectionContext context, AssemblyDefinition item)
    at Unity.IL2CPP.AssemblyConversion.Steps.Base.ScheduledItemsStepFuncWithContinueFunc`4.WorkerWrapper(WorkItemData`3 workerData)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.ContinueWithResultsWorkItem`4.InvokeWorker(Object context, Int32 uniqueId)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.BaseContinueWorkItem`2.Invoke(Object context, Int32 uniqueId)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.WorkerLoop(Object data)
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Thanks for the details. I'm going to guess that the error message is pointing to the wrong line of code, unfortunately.

    I'll ask our QA team to prioritize this bug report - we'll need to investigate this to understand the problem.
     
    stonstad likes this.
  7. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Build Attempt #4. Failure location originates from Unity package code.


    C:\Program Files\Unity\Hub\Editor\2021.3.15f1\Editor\Data\il2cpp\build\deploy\il2cpp.exe @Library\Bee\artifacts\rsp\4115519617908147460.rsp
    Error: IL2CPP error for type 'UnityEngine.XR.InputDeviceCharacteristics' in assembly 'C:\Source\XXX\XXX\Library\Bee\artifacts\WinPlayerBuildProgram\ManagedStripped\UnityEngine.XRModule.dll'
    System.NotImplementedException: The method or operation is not implemented.
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.Process(Instruction instruction, MethodDefinition method, Boolean fullGenericSharing)
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.ProcessType(TypeDefinition type)
    at Unity.IL2CPP.GenericSharing.GenericSharingVisitor.Collect(AssemblyDefinition assembly)
    at Unity.IL2CPP.AssemblyConversion.PrimaryCollection.Steps.Global.GenericSharingAnalysis.ProcessItem(GlobalPrimaryCollectionContext context, AssemblyDefinition item)
    at Unity.IL2CPP.AssemblyConversion.Steps.Base.ScheduledItemsStepFuncWithContinueFunc`4.WorkerWrapper(WorkItemData`3 workerData)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.ContinueWithResultsWorkItem`4.InvokeWorker(Object context, Int32 uniqueId)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.BaseContinueWorkItem`2.Invoke(Object context, Int32 uniqueId)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.WorkerLoop(Object data)
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
     
  8. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Thank you!
     
  9. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    FWIW, I am also seeing this in 2022.2.1f1.
     
    Last edited: Dec 30, 2022
  10. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Since the issue manifests across two versions of Unity separated by a year, I'm inclined to think there is an environmental cause. I installed older versions of the Windows SDK, as well as VC++ libraries thinking it is a version compat issue. Unfortunately, this didn't remedy the issue. I am really needing to get a build out. Is there anything I can try?
     
  11. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
  12. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Tried:

    Preferences -> Diagnostics -> Editor -> VMIl2CppAditionalArgs --disable-generic-sharing
    and
    Project Settings-> IL2CPP Code Generation -> Faster (smaller) Builds

    I wonder what other settings besides --disable-generic-sharing that might be worth trying...











     
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Thanks! I don't see much action on this from our QA team - I'll follow up again. Does this only happen when the "Faster (smaller) Builds" option is used?
     
  14. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Thank you for following up. I tried with both build options (smaller vs faster) and I see the same behavior. I’m open to trying anything — I’m out of ideas.
     
  15. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Thanks for the details - I'll try to get this moving and get back to you via the bug report with a work around at the very least.
     
  16. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    @JoshPeterson I'm working to get a reduced size project sent over. I'm starting at over 100GB, and it is taking some time. In the interim, I asked the Customer QA team if they could review source for GenericSharingVisitor.Process and advise what scenarios cause a NotImplementedException to be thrown.
     
  17. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Thanks! I don't think our QA team will be able to do that, but I did have a look at the code myself. It looks like the not implemented case is a catch-all at the bottom of a switch statement used for handling many different IL opcodes.

    So if you don't have success putting together a smaller project, let me know, and I can send you a custom assembly with better logging so that at least we can get a sense for what is happening.
     
  18. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    Thanks Josh! I updated the ticket with a download link to a project (1.3GB) which reproduces the issue in my environment.
     
  19. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Excellent, thank you!
     
  20. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    I appreciate all of your help. Do you know if a work-around might exist? I'm very much hoping to produce a build. The 2021 and 2022 Unity versions seem to have the same behavior.
     
  21. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Sorry, I don't have a work around yet. I'm still working with our QA to get this processed.
     
  22. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    659
    kk. Would it help to send a direct link to the repro project? Separately, I'm ready to run a debug DLL and share diagnostic output. I haven't been able to produce a build for over a month and I don't know which line of C# code is tripping up GenericSharingVisitor due to the incorrect stack tracing.
     
  23. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    It looks like our QA team has just processed this, so I have access to the project. I'll see if I can at least determine the cause to allow you to work around the issue.
     
    stonstad likes this.