dnSpyEx / dnSpy

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

Can't save modules after using unmanaged type delegate #373

Open BerryDomi opened 1 month ago

BerryDomi commented 1 month ago

dnSpyEx version

6.5.1

Describe the Bug

a .net8.0 dll cannot save the module after using unmanaged type delegation, does the current version(6.5.1) of dnspy ​​add support for this type? 2a49692d5d924f37a3635fce9ce9be5c 1eb76d7acbaf7ccbddd2d70b726223b6 7c5a67ef7bd07f770d6b68281ffbc572

How To Reproduce

using unmanaged type delegations.

Expected Behavior

successfully save modules of those using unmanaged type delegations.

Actual Behavior

failing at saving modules.

Additional Context

No response

ElektroKill commented 1 month ago

Hi, this looks like a metadata reading error 🤔

If it is possible, please provide me with a compiled file I can use to reproduce the issue. If you do not want to share it publicly, you can provide it to me via email elektrokilldev@protonmail.com

Thanks in advance!

BerryDomi commented 1 month ago

Hi, this looks like a metadata reading error 🤔

If it is possible, please provide me with a compiled file I can use to reproduce the issue. If you do not want to share it publicly, you can provide it to me via email elektrokilldev@protonmail.com

Thanks in advance!

sorry for the delay,i'll send you the compiled file right now.

ElektroKill commented 4 weeks ago

Hey,

I took a look at the file you provided and this seems to be an issue with the file itself rather than dnSpy.

Taking a look at the raw metadata found in the file, it is clearly visible that these two fields do not have a signature defined. The offset to the signature data is set to 0 indicating no signature. This is invalid according to .NET metadata specification and suggests that there either was an issue when compiling the file or it was edited in some way which broke this metadata.

image

There is unfortunately nothing I can do in dnSpy to fix the issue during saveing. dnSpy is just reporting that these fields don't contain any signature defined in the metadata.