Redefinition error (C2365) in C++/CLI caused by Babel Obfuscator
-
14-11-2019 - |
Question
When I obfuscate my assebly (DLL with custom control) written in C#. It works in both C# and VB.NET apps.
When I use the DLL from C++/CLI app, however, errors like this appear during build:
error C2365: 'ComponentOwl::BetterSplitButton::BetterSplitButton::e' : redefinition; previous definition was 'property'
The "e" refers to either internal enum member, private property name etc.
Is it possible to instruct Babel obfuscator to not generate duplicate names (I have not found such switch). Or is it avoidable from code?
Solution
Babel.NET Support reproduced the problem and suggested to add command-line parameter:
--namelength 4
So the name conflict will be less probable.
They tested the non-working solution and found that obfuscated assembly has no metadata errors, but the C++/CLI compiler still complains there are two or more different symbols with the same name in a given type.