dnSpyEx / dnSpy

Unofficial revival of the well known .NET debugger and assembly editor, dnSpy
GNU General Public License v3.0
6.14k stars 412 forks source link

ModuleWriterException: Invalid section RVA #300

Closed Drovosek01 closed 4 months ago

Drovosek01 commented 4 months ago

Description

I'm exploring. A dll file compiled using dotNet on a Mac with Apple Silicon processors.

I open the file in dnSpyEx v6.5.0 and then just try to save the module without any modifications

Screenshot 2024-02-19 at 16 03 42

and I get an error:

An exception has occurred dnlib.DotNet.Writer.ModuleWriterException: Invalid section RVA
   at dnlib.DotNet.Writer.NativeModuleWriter.WriteFile()
   at dnlib.DotNet.Writer.NativeModuleWriter.Write()
   at dnlib.DotNet.Writer.NativeModuleWriter.WriteImpl()
   at dnlib.DotNet.Writer.ModuleWriterBase.Write(Stream dest)
   at dnlib.DotNet.Writer.ModuleWriterBase.Write(String fileName)
   at dnlib.DotNet.ModuleDefMD.NativeWrite(String filename, NativeModuleWriterOptions options)
   at dnSpy.AsmEditor.SaveModule.ModuleSaver.Save(SaveModuleOptionsVM vm) in D:\a\dnSpy\dnSpy\Extensions\dnSpy.AsmEditor\SaveModule\ModuleSaver.cs:line 187
   at dnSpy.AsmEditor.SaveModule.ModuleSaver.SaveAll() in D:\a\dnSpy\dnSpy\Extensions\dnSpy.AsmEditor\SaveModule\ModuleSaver.cs:line 151
   at dnSpy.AsmEditor.SaveModule.SaveMultiModuleVM.SaveAsync(SaveOptionsVM[] mods) in D:\a\dnSpy\dnSpy\Extensions\dnSpy.AsmEditor\SaveModule\SaveMultiModuleVM.cs:line 250
Screenshot 2024-02-19 at 16 04 00

I tried to do this on Windows 10 x64 on an AMD laptop, and also tried to do it on Windows 11 ARM via Parallels Desktop and always get the same error.

Does anyone know how to fix this? Here is an example of such a file: CsvHelper dll for arm64.zip

GazziFX commented 4 months ago

I think you should create issue in dnlib repo

ElektroKill commented 4 months ago

This issue is out of scope for dnSpyEx, all further discussions such continue over on the respective dnlib issue! https://github.com/0xd4d/dnlib/issues/545