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

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

Open
BerryDomi opened this issue Oct 22, 2024 · 4 comments
Open

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

BerryDomi opened this issue Oct 22, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@BerryDomi
Copy link

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

@BerryDomi BerryDomi added the bug Something isn't working label Oct 22, 2024
@ElektroKill
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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.

@omlk
Copy link

omlk commented Jan 3, 2025

Maybe you have a different situation, but it happens when you click edit class and change fields or method arguments in code, and not through the graphical interface. If you click edit method (alt+enter), and edit everything in the graphical interface, then when applying the changes, in all places where this method was called everything will also be changed, and if you add new arguments, it will lead to errors in other places, since dnspy does not know how to resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants