Patrick Braunstorfer
Patrick Braunstorfer

Reputation: 383

Methodnames in Output-Assembly

I am compiling a project with Visual Studio 2013 against .NET 4.5 and then checking it again with ILDASM.

What I noticed is that the build in Release still contains method names and variable names, I thought these should be removed in a release-build or do I need an obsfuscator to do that?

Upvotes: 0

Views: 43

Answers (2)

IS4
IS4

Reputation: 13207

As for method names, the compiler doesn't know if your assembly will be used or not in another project, so the preservation of method names is logical. Though variable names can't be used anywhere than in the method where they're defined, I guess it is useful for debugging (be it Debug or Release) and they really take insignificant space.

And my advice, don't use obfuscator, unless your application contains security critical codes (and then, I'd still advise obfuscating just this code, not the other methods). It is way better for debugging and reading exceptions.

Upvotes: 1

David Waters
David Waters

Reputation: 12028

You need an obsfuscator to hide method and member names, local variable names should be stripped by the compiler, but anything that can turn up using reflection is preserved that includes class and interface names, public and private methods, public and private fields.

Upvotes: 4

Related Questions