Closed adrium closed 5 years ago
Currently we do not have an option to replace invalid identifiers in output. Are you using ILSpy or a custom tool based on the decompiler engine for this task?
I implemented a replacement function in #1440.
To convert, I wrote a quick and dirty tool which takes an assembly and a target language version and decompiles it to one string.
So to convert, I compile and decompile with a different language version.
I thought we already had logic that escaped invalid identifiers?
It's intentionally not enabled in the ILSpy UI (there's no need for escaping there; so we only handle non-printable characters); but the whole project decompiler uses it.
See class EscapeInvalidIdentifiers
.
Oh I did not see that class, thanks for the hint.
Sure, for the UI it is not needed. Closing the issue and pull request.
I am using the decompiler to convert code from C# 7.0 to C# 2. Everything went fine except the following:
Given the code:
The decompiler generates the backing field as
<Property>k__BackingField
which I think is the name actually generated by the compiler. Anyway, the resulting code can not be compiled as is. The resulting errors are:I think it would be useful if the angle brackets are replaced by underscores, if the assembly is decompiled to C#.
Is there already a solution to this? I looked through the setting classes, but did not find anything to solve the issue.