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

Cpp2IL.Core.Exceptions.DllSaveException #53

Closed
Jdewi12 opened this issue Nov 12, 2021 · 5 comments
Closed

Cpp2IL.Core.Exceptions.DllSaveException #53

Jdewi12 opened this issue Nov 12, 2021 · 5 comments

Comments

@Jdewi12
Copy link

Jdewi12 commented Nov 12, 2021

Tried to use this on a Nintendo Switch build of a game made with Unity using the force- options with --experimental-enable-il-to-assembly-please and --throw-safety-out-the-window.

I'm using the latest windows build from https://github.com/SamboyCoding/Cpp2IL/actions/runs/1450922865

At the end I get the following exception:

[Fail] [Program] Cpp2IL.Core.Exceptions.DllSaveException: Fatal Exception writing DLL E:\Downloads\Cpp2IL-Windows (1)\cpp2il_out\Assembly-CSharp.dll
 ---> Cpp2IL.Core.Exceptions.TypeWriteFailedException: Failed to write type Dpr.Battle.View.TaskSealEffects due to an exception
 ---> Cpp2IL.Core.Exceptions.MethodWriteFailedException: Failed to write body for method System.Void Dpr.Battle.View.TaskSealEffects::.ctor(Dpr.ObjectEntity,System.Collections.Generic.List`1<Dpr.Battle.View.Objects.BtlvEffectInstance>,System.Single,System.Int32) due to an exception
 ---> Cpp2IL.Core.Exceptions.InstructionWriteFailedException: Failed to write operand for instruction IL_003d: ldtoken Dpr.Battle.View.FromToPair`1<UnityEngine.Vector3>[] due to an exception
 ---> System.ArgumentException: Member 'UnityEngine.Vector3' 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 Mono.Cecil.SignatureWriter.WriteGenericInstanceSignature(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 DMD<Mono.Cecil.Cil.CodeWriter::WriteMethodBody>(CodeWriter this, MethodDefinition method)
   --- End of inner exception stack trace ---
   at DMD<Mono.Cecil.Cil.CodeWriter::WriteMethodBody>(CodeWriter this, MethodDefinition method)
   at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
   at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
   at DMD<Mono.Cecil.MetadataBuilder::AddType>(MetadataBuilder this, TypeDefinition type)
   --- End of inner exception stack trace ---
   at DMD<Mono.Cecil.MetadataBuilder::AddType>(MetadataBuilder this, 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)
   at Cpp2IL.Program.MainWithArgs(Cpp2IlRuntimeArgs runtimeArgs)
   at Cpp2IL.Program.Main(String[] args)

There are also more (seemingly non-fatal) errors throughout the process; I've attached the full log in case they're relevant.
log.txt

@SamboyCoding
Copy link
Owner

Yeah, the various errors in the process are somewhat expected - the application isn't perfect (yet!) so failures here and there are expected. This one in specific is an oversight on my part - I likely won't be able to solve it tonight (though I do know and have access to the nso of which you speak) because it's my birthday and I'm out with family and friends, but I'll try and fix this tomorrow for you.

@Jdewi12
Copy link
Author

Jdewi12 commented Nov 13, 2021

Happy birthday!

And yeah I figured from the big red warnings that errors were kinda expected haha.

@SamboyCoding
Copy link
Owner

Okay, the root cause of this issue is due to the problems finding il2cpp api functions on NSO binaries, which have their list of exported functions changed to not include any il2cpp ones. That's causing cpp2il to not get a good analysis for the method in question. However, the actual error is still a problem, so for now I'll add a solution, but it needs fixing in proper detail later down the line.

@SamboyCoding
Copy link
Owner

Should work now - does on my machine at least

@Jdewi12
Copy link
Author

Jdewi12 commented Nov 14, 2021

Yep worked!

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

No branches or pull requests

2 participants