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

Unity game .dll file, can't compile because of some tuple error. #293

Closed mrwallace888 closed 4 months ago

mrwallace888 commented 4 months ago

dnSpyEx version

6.5.0

Describe the Bug

Sometimes when editing the some of my Unity games' .dll files, I can't recompile. dnSpy keeps giving me this error. Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.

It's annoying and I've no idea how to fix it, all I wanted to do was see what would happen if I changed one single line of code unrelated to the tuple thing, it was some coroutine or physics thing I was trying to edit.

How To Reproduce

Pick a line of code (not sure what, just sometimes I can't compile certain bits), and click "Edit Class" or "Edit Method". Now click "compile", and even without editing anything, this error pops up.

Expected Behavior

Well I'd expect it to recompile. It decompiled just fine, and most other Unity games don't have issues when recompiling them.

Actual Behavior

The error pops up numerous times.

Additional Context

I'm just trying to figure out if there's a way around it. In my current case it's a separate .dll, some SDK dll which seemed to get opened in the list in dnSpy after I clicked "AssemblyCSharp.dll". Not sure if that's essentially relevant to this error or not.

eebssk1 commented 4 months ago

Got such situation too,But.. For single and small change you can try to learn about IL and use the ILEditor instead.

MadProbe commented 4 months ago

This is a duplicate of issue #133 and will be fixed once dnSpy will upgrade to latest ILSpy version and its progress is tracked in issue #5.

ElektroKill commented 4 months ago

As @MadProbe mentioned, this will be fixed when dnSpy is updated to the latest ILSpy decompiler engine. The current engine does not support value tuple type syntax leading to the issue you are facing. Closing as duplicate of #133!