Search Unity

Bug (IN-35799) [1.0.0-pre.47] NotImplementedException: The method or operation is not implemented

Discussion in 'NetCode for ECS' started by optimise, Mar 20, 2023.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    I have codegen setup that no longer working at 1.0. Previously before 1.0 it's working properly but starting from first release of 1.0 until current 1.0.0-pre.47, it's still not working.
     
  2. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
  3. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    This bug is due to one of your custom packages. If you looks a the log:
    Code (csharp):
    1.  
    2. NotImplementedException: The method or operation is not implemented.
    3.   at ILRuntime.Runtime.CLRBinding.BindingGeneratorExtensions.GetReturnValueCode (System.Type type, System.Text.StringBuilder sb, ILRuntime.Runtime.Enviorment.AppDomain domain) [0x00236] in .\Library\PackageCache\com.ourpalm.ilruntime@2.1.0\Runtime\CLRBinding\BindingGeneratorExtensions.cs:447
    4.   at ILRuntime.Runtime.CLRBinding.MethodBindingGenerator.GenerateMethodWraperCode (System.Type type, System.Reflection.MethodInfo[] methods, System.String typeClsName, System.Collections.Generic.HashSet`1[T] excludes, System.Collections.Generic.List`1[T] valueTypeBinders, ILRuntime.Runtime.Enviorment.AppDomain domain) [0x01225] in .\Library\PackageCache\com.ourpalm.ilruntime@2.1.0\Runtime\CLRBinding\MethodBindingGenerator.cs:632
    5.   at ILRuntime.Runtime.CLRBinding.BindingCodeGenerator.GenerateBindingCode (ILRuntime.Runtime.Enviorment.AppDomain domain, System.String outputPath, System.Collections.Generic.List`1[T] valueTypeBinders, System.Collections.Generic.List`1[T] delegateTypes, System.Int32 maxGenericDepth, System.String[] excludeFiles) [0x002bd] in .\Library\PackageCache\com.ourpalm.ilruntime@2.1.0\Runtime\CLRBinding\BindingCodeGenerator.cs:301
    6.  
    I don't know what com.ourpalm.ilruntime is actually doing at all, but it does not looks like something related to Netcode for Entities at all.

    There is also another problem related to the fact the Unity.Logging generator is actually trying to process the Mono asmdef (even though it should not), that is also strange.

    It seems a build pipeline issue
     
  4. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Ya. Basically is caused by logging package bug that make it can't work properly anymore. Before 1.0 it's working properly but at 1.0 now has this logging package make it can't work anymore. So something needs to be done at logging package to fix this issue.
     
    Last edited: Apr 2, 2023
  5. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    No, it is that ILRuntime that is broken. I dunno why you need it, but regardless, It does not handle correctly primitive types (IntPtr are primitive types) and so explode because of the injected logging code that has method that return IntPtr.
    However the logging code is perfectly legit code and the Unity.Logging package does not need any change in that regard.

    I would say that ILRuntime need definitively changes to support correctly that kind of primitive return values.

    But that being said, there is still something strange. Why is Unity.Logging generator invoked?
     
    Last edited: Apr 2, 2023
  6. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    The question is in-fact: What the AssemblyBuilder does ?
    I think, erroneously, because your assembly is not referencing neither Entities, nor Netcode nor Logging, it is adding relying analyser and generators even though they should not be added to the compilation.
    But actually, tested myself, all generators and analyzers are always passed, not matter what.
    And unfortunately they are added in an internal method, not directly accessible.

    So, to confirm, this is an Editor compilation pipeline problem.

    The only thing you can do, to avoid this is to modify the logging source generator and early exiting if the logging package is not part of the references.
    I'm expecting this should be already the case though.
     
    Last edited: Apr 2, 2023
  7. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    I see. I dun need to include logging package. How should I skip it?
     
  8. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    I think the easiest workaround is to exclude the reference from the AssemblyBuilder for now:

    Code (csharp):
    1.  
    2. assemblyBuilder.excludeReferences = new[] { "Library/ScriptAssemblies/Unity.Logging.dll" };
    3.  
    This will remove the Unity.Logging reference and avoid the generator running.
    You can also exclude other assemblies if necessary.

    There are remaining questions about how the AssemblyBuilder setup the compilation. It is adding all the possible references, generator etc etc. It is actually identical compiling Assembly-CSharp pretty much.