TouchSocket
TouchSocket copied to clipboard
bug(): unity使用时无法正常发布
Is there an existing issue for this?
- [x] I have searched the existing issues
Describe the bug
unity内使用nuget导入包,发布时采用il2cpp模式在打包apk时报错了。 (编辑器内运行是没问题的,怀疑和il2cpp有关系) version:TouchSocket.Core 3.1.18 错误内容:
C:\Program Files\Unity\Hub\Editor\2022.3.47f1\Editor\Data\il2cpp\build\deploy\il2cpp.exe --convert-to-cpp --assembly=Library/Bee/artifacts/Android/ManagedStripped/Assembly-CSharp.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/LiteNetLib.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Mono.Security.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/mscorlib.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Newtonsoft.Json.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Pcx.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/PICO.Platform.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Configuration.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Core.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Data.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Drawing.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Numerics.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Runtime.CompilerServices.Unsafe.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Runtime.Serialization.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Text.Encodings.Web.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Text.Json.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Xml.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/System.Xml.Linq.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/TouchSocket.Core.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/TouchSocket.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Unity.InputSystem.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Unity.InputSystem.ForUI.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Unity.Mathematics.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Unity.XR.CoreUtils.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Unity.XR.Interaction.Toolkit.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Unity.XR.Management.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/Unity.XR.PICO.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.AndroidJNIModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.AnimationModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.AudioModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.CoreModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.GridModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.ImageConversionModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.IMGUIModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.InputLegacyModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.InputModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.JSONSerializeModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.Physics2DModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.PhysicsModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.PropertiesModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.SharedInternalsModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.SpatialTracking.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.SpriteShapeModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.SubsystemsModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.TextCoreFontEngineModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.TextCoreTextEngineModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.TextRenderingModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.TilemapModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.UI.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.UIElementsModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.UIModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.UnityWebRequestModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.UnityWebRequestTextureModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.VRModule.dll --assembly=Library/Bee/artifacts/Android/ManagedStripped/UnityEngine.XRModule.dll --generatedcppdir=G:/Project/Source/PicoClient/Library/Bee/artifacts/Android/il2cppOutput/cpp --symbols-folder=G:/Project/Source/PicoClient/Library/Bee/artifacts/Android/il2cppOutput/cpp/Symbols --enable-analytics --emit-null-checks --enable-array-bounds-check --dotnetprofile=unityaot-linux --profiler-report --profiler-output-file=G:/Project/Source/PicoClient/Library/Bee/artifacts/il2cpp_conv_zxvp.traceevents --print-command-line --data-folder=G:/Project/Source/PicoClient/Library/Bee/artifacts/Android/il2cppOutput/data
Error: IL2CPP error for method 'System.Void TouchSocket.Core.FastBinaryFormatter::SerializeIListOrArray(TByteBlock&,System.Collections.IEnumerable&,TouchSocket.Core.FastSerializerContext)' in assembly 'G:\Project\Source\PicoClient\Library\Bee\artifacts\Android\ManagedStripped\TouchSocket.Core.dll'
System.NotImplementedException: No support for assigning to/from variable size types and concrete types TByteBlock&, TByteBlock
at Unity.IL2CPP.MethodBodyWriter.IsFullySharedTypeAssignment(ReadOnlyContext context, ResolvedTypeInfo leftType, ResolvedTypeInfo rightType)
at Unity.IL2CPP.MethodBodyWriter.GetAssignment(ReadOnlyContext context, String leftName, ResolvedTypeInfo leftType, StackInfo right, VariableSizedTypeSupport variableSizedTypeSupport, SharingType sharingType)
at Unity.IL2CPP.MethodBodyWriter.WriteStloc(ResolvedVariable variableDefinition)
at Unity.IL2CPP.MethodBodyWriter.ProcessInstruction(Node node, InstructionBlock block, ResolvedInstruction ins)
at Unity.IL2CPP.MethodBodyWriter.GenerateCodeRecursive(Node node, ReadOnlyDictionary`2 instructionBlocks)
at Unity.IL2CPP.MethodBodyWriter.Generate()
at Unity.IL2CPP.CodeWriters.CodeWriterExtensions.WriteMethodWithMetadataInitialization(IGeneratedMethodCodeWriter writer, String methodSignature, Action`2 writeMethodBody, String uniqueIdentifier, MethodReference methodRef, WritingMethodFor writingMethodFor)
at Unity.IL2CPP.MethodWriter.WriteMethodDefinition(AssemblyWriteContext context, IGeneratedMethodCodeWriter writer, MethodReference method)
at Unity.IL2CPP.SourceWriter.WriteGenericMethodDefinition(SourceWritingContext context, IGeneratedMethodCodeWriter writer, GenericInstanceMethod method)
at Unity.IL2CPP.SourceWriters.SourceWriterBase`2.WriteItem(StreamWorkItemData`2 data)
at Unity.IL2CPP.Contexts.Scheduling.Streams.FileLevelParallelStreamManager`3.WorkerWriteItemsToFile(WorkItemData`2 data)
at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.WorkerLoop(Object data)
Error: IL2CPP error for method 'TouchSocket.Core.FilterResult TouchSocket.Core.CustomBetweenAndDataHandlingAdapter`1::Filter(T&,System.Boolean,TBetweenAndRequestInfo&,System.Int32&)' in assembly 'G:\Project\Source\PicoClient\Library\Bee\artifacts\Android\ManagedStripped\TouchSocket.Core.dll'
System.NotImplementedException: No support for assigning to/from variable size types and concrete types T&, T
at Unity.IL2CPP.MethodBodyWriter.IsFullySharedTypeAssignment(ReadOnlyContext context, ResolvedTypeInfo leftType, ResolvedTypeInfo rightType)
at Unity.IL2CPP.MethodBodyWriter.GetAssignment(ReadOnlyContext context, String leftName, ResolvedTypeInfo leftType, StackInfo right, VariableSizedTypeSupport variableSizedTypeSupport, SharingType sharingType)
at Unity.IL2CPP.MethodBodyWriter.WriteStloc(ResolvedVariable variableDefinition)
at Unity.IL2CPP.MethodBodyWriter.ProcessInstruction(Node node, InstructionBlock block, ResolvedInstruction ins)
at Unity.IL2CPP.MethodBodyWriter.GenerateCodeRecursive(Node node, ReadOnlyDictionary`2 instructionBlocks)
at Unity.IL2CPP.MethodBodyWriter.Generate()
at Unity.IL2CPP.CodeWriters.CodeWriterExtensions.WriteMethodWithMetadataInitialization(IGeneratedMethodCodeWriter writer, String methodSignature, Action`2 writeMethodBody, String uniqueIdentifier, MethodReference methodRef, WritingMethodFor writingMethodFor)
at Unity.IL2CPP.MethodWriter.WriteMethodDefinition(AssemblyWriteContext context, IGeneratedMethodCodeWriter writer, MethodReference method)
at Unity.IL2CPP.SourceWriter.WriteGenericMethodDefinition(SourceWritingContext context, IGeneratedMethodCodeWriter writer, GenericInstanceMethod method)
at Unity.IL2CPP.SourceWriters.SourceWriterBase`2.WriteItem(StreamWorkItemData`2 data)
at Unity.IL2CPP.Contexts.Scheduling.Streams.FileLevelParallelStreamManager`3.WorkerWriteItemsToFile(WorkItemData`2 data)
at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.WorkerLoop(Object data)
UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
Unity.XR.PXR.Editor.PXR_SDKBuildCheck:OnBuild (UnityEditor.BuildPlayerOptions) (at F:/Unity/PackageOnDisk/PICO Unity Integration SDK_3.1.0_20250109/Editor/PXR_SDKBuildCheck.cs:67)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response