Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to export DLL on PCBuildingSimulator2 #151

Open
Sootie1776 opened this issue Oct 14, 2022 · 1 comment
Open

Failed to export DLL on PCBuildingSimulator2 #151

Sootie1776 opened this issue Oct 14, 2022 · 1 comment

Comments

@Sootie1776
Copy link

Similar issue to #53 but with UnityEngine.UI.Selectable

System.ArgumentException: Member 'UnityEngine.UI.Selectable' is declared in another module and needs to be imported

Used --just-give-me-dlls-asap-dammit, if I'm just being dumb let me know how to be less dumb thanks

[Info] [Program] Overall analysis success rate: 92% (37209) of 40388 methods.
[Info] [Program] Saving 1 assembly to F:\Games\Epic\PCBuildingSimulator2\cpp2il_out...
[Fail] [Program] Cpp2IL.Core.Exceptions.DllSaveException: Fatal Exception writing DLL F:\Games\Epic\PCBuildingSimulator2\cpp2il_out\Assembly-CSharp.dll
 ---> Cpp2IL.Core.Exceptions.InstructionWriteFailedException: Failed to write operand for instruction IL_0089: ldelem.any System.ValueTuple`2<UnityEngine.UI.Selectable,System.Boolean> due to an exception
 ---> Cpp2IL.Core.Exceptions.GenericInstanceWriteFailedException: Failed to write generic instance System.ValueTuple`2<UnityEngine.UI.Selectable,System.Boolean> due to an exception
 ---> System.ArgumentException: Member 'UnityEngine.UI.Selectable' is declared in another module and needs to be imported
   at Mono.Cecil.MetadataBuilder.LookupToken(IMetadataTokenProvider provider)
   at Mono.Cecil.SignatureWriter.WriteTypeSignature(TypeReference type)
   at DMD<Mono.Cecil.SignatureWriter::WriteGenericInstanceSignature>(SignatureWriter this, IGenericInstance instance)
   --- End of inner exception stack trace ---
   at DMD<Mono.Cecil.SignatureWriter::WriteGenericInstanceSignature>(SignatureWriter this, IGenericInstance instance)
   at Mono.Cecil.MetadataBuilder.GetTypeSpecToken(TypeReference type)
   at Mono.Cecil.MetadataBuilder.LookupToken(IMetadataTokenProvider provider)
   at DMD<Mono.Cecil.Cil.CodeWriter::WriteOperand>(CodeWriter this, Instruction instruction)
   --- End of inner exception stack trace ---
   at DMD<Mono.Cecil.Cil.CodeWriter::WriteOperand>(CodeWriter this, Instruction instruction)
   at Mono.Cecil.Cil.CodeWriter.WriteInstructions()
   at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method)
   at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
   at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
   at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
   at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
   at Mono.Cecil.MetadataBuilder.AddTypes()
   at Mono.Cecil.MetadataBuilder.BuildTypes()
   at Mono.Cecil.MetadataBuilder.BuildModule()
   at Mono.Cecil.MetadataBuilder.BuildMetadata()
   at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
   at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
   at Cpp2IL.Core.Cpp2IlApi.SaveAssemblies(String toWhere, List`1 assemblies)
   --- End of inner exception stack trace ---
   at Cpp2IL.Core.Cpp2IlApi.SaveAssemblies(String toWhere, List`1 assemblies)
   at Cpp2IL.Program.DoAnalysisForAssembly(String assemblyName, AnalysisLevel analysisLevel, String rootDir, BaseKeyFunctionAddresses keyFunctionAddresses, Boolean doIlToAsm, Boolean parallel, Boolean continueThroughErrors, Boolean skipDumps)
   at Cpp2IL.Program.MainWithArgs(Cpp2IlRuntimeArgs runtimeArgs)
   at Cpp2IL.Program.Main(String[] args)
@SamboyCoding
Copy link
Owner

Yeah unfortunately you've run in to the core reason why I wanted to switch away from Mono.Cecil, and as a result had to rewrite the project (because the current one relies way too much on Cecil) - it's really difficult to fully import an arbitrarily-complex type reference.

Theoretically I could actually do a brute-force port of the existing Cpp2IL to AsmResolver without the rewrite, and maybe I will end up doing so just to fix these sorts of issues, but that will also take time which is not something I have much of right now. Will leave this issue open for now though, if that's ok with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants