C++/CLI obfuscated assembly throws a MissingManifestResourceException

1.3k Views Asked by At

I'm using Dotfuscator Pro 4.10 to obfuscate an application built with VS 2012. The .NET code contains managed as well as unmanaged C++/CLI code, thus compiled with /clr.

My solution contains a lot of projects. I only allow renaming as obfuscation. Also, as all assemblies/application are in the dotfuscator project, I don't run in library mode. Thus, all interfaces are scrambled.

When I obfuscate the assemblies everything works fine but for an assembly (let's call it A.dll). If I disable obfuscation for A.dll, the application works perfectly. If I enable obfuscation for A.dll, I get this:

Error: System.Resources.MissingManifestResourceException

Message: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "ahe.resources" was correctly embedded or linked into assembly "A.dll" at compile time, or that the satellite assemblies required are loadable and fully signed.

ahe is the scrambled name of a Window Form in A.dll and the exception is thrown here (from ApplyResources()):

void InitializeComponent( void )
{
    this->components = (gcnew System::ComponentModel::Container());
    System::ComponentModel::ComponentResourceManager^resources = (gcnew System::ComponentModel::ComponentResourceManager( A::typeid ));

    // ...

    resources->ApplyResources( this->mpMyControl, L"mpMyControl" ); // Exception thrown here.

    // ...
}

The resources are correctly defined in A.resx (and it works before obfuscating).

Notice that this kind of code is used at many places in other assemblies and, when I disallow obfuscation for the problematic assembly A.dll, it works perfectly.

So, does somebody have an idea about how to solve the problem? Feel free to ask for more info/details, I don't know what could be important or not.

Thanks!

Edit 1: None of the assemblies are signed.

2

There are 2 best solutions below

0
On

One Scott has reported at http://www.pcreview.co.uk/forums/dotfuscator-vs-resourcemanager-ctor-t3403701.html that this problem is addressed in the Dotfuscator's Knowledge base, which is available only to registered users of the Community edition here: http://www.preemptive.com/support/dotfuscator/KnowledgeBase/CommunityEdition.html .

0
On

Check if your root namespace is correct in .vcxproj file:

<RootNamespace>YourNameSpace</RootNamespace>