Linux R2R mixed dll can't be saved.
If you try to save a R2R linux mixed module dnlib run on an exception.
dnlib.DotNet.Writer.ModuleWriterException: Invalid section RVA
The module is published with:
dotnet publish -c Release -r linux-x64 -p:PublishReadyToRun=true
R2R.ZIP
R2R was never supported. Can you just save it as a normal .NET assembly without any native code (I assume the metadata and original IL code is still in the file).
https://github.com/0xd4d/dnlib/blob/8f7edaf55d5e3dd8627e6776440cc7fcf6d43b28/src/DotNet/Writer/NativeModuleWriter.cs#L456-L459
Maybe with this little test dll would work, but I tryed more complex module and it stoped running on linux. Only way I was able to make it work if I did the following:
1.) Use "crossgen2.exe --compile-no-methods --targetos:windows" to strip native code and convert it to windows PE. 2.) Save module (because it is a windows PE still mixed assembly) 3.) Use "crossgen2.exe --compile-no-methods --targetos:linux" to convert it back to linux PE