DnSpy decompiled output has syntax errors and can not be recompiled, in particular "<>f__switch$map1"

2.7k Views Asked by At

I have a program which no longer has support and does not have source code available. So I decompiled it in order to make fixes, because the fixes required are substantial I decided to use dnSpy to export the decompiled code as a project, however there are some errors. in particular I see variable names that look like <>f__switch$map1 where the can be any number in place of 1. I tried replacing them all with a more reasonable name and removing the <> but it doesn't appear to actually be declared anywhere? how can I fix these compiler errors in the output of dnSpy.

1

There are 1 best solutions below

0
On

So, in my case I was simply able to rename everything and then define it elsewhere, this worked and the program was able to compile.