Dotfuscator vs ResourceManager ctor

S

Scott

Hi,

I am trying to apply obfuscation to our project using Dotfuscator.
When i run the post obfuscated .exe, i get a
MissingManifestResourceException. I have isolated the problem and it
can be reproduced with the following steps:

1. Create a simple Windows Forms app
2. Right click on the project and choose Add > New Item > Resources
File
3. Double click the new Resource1.resx object in Solution Explorer
4. Enter a new string resource called 'test' with value 'test'
5. Double click your form 'Form1' in Solution Explorer
6. Right click on Form and choose 'View Code'
7. In the constructor of your Form1 class add the line "Text =
Resource1.test;"
8. Build and run and you should see that the name of your window is
'test'
9. Alls well so far
10. Now boot Dotfuscator, create a new project and add your built .exe
file to the input
11. Hit the play button to obfuscate your assembly
12. Go to the output folder (default is *user*\Documents\Dotfuscated
\), run app and you will find it crashes
15. Follow prompts to debug in new instance of DevStudio and you
should see the following error:

"An unhandled exception of type
'System.Resources.MissingManifestResourceException' occurred in
mscorlib.dll

Additional information: Could not find any resources appropriate for
the specified culture or the neutral culture. Make sure
"WindowsFormsApplication1.Resource1.resources" was correctly embedded
or linked into assembly "WindowsFormsApplication5" at compile time, or
that all the satellite assemblies required are loadable and fully
signed."

14. Drop .exe file into Reflector and search for 'Resource1' under the
category 'String or Constant'
15. You will find a reference to piece of code like the following:

internal static ResourceManager c()
{
if (object.ReferenceEquals(a, null))
{
ResourceManager manager = new
ResourceManager("WindowsFormsApplication1.Resource1",
typeof(e).Assembly);
a = manager;
}
return a;
}


Phew :)

This is auto-generated code. My question is what should i do about
this? In my full size project there are dozens of resources loaded
like this which generate ResourceManager constructor calls. I don't
want to go through every resource and exclude it from obfuscation
manually. Having said that, i don't mind if all the resources are
excluded from obfuscation, that is ok. There is no regular expression
which would identify the resources specifically enough without roping
in loads of other type (class) names. None of the provided attributes
seem to do the trick and i can't see a way to add more.

Please help!

Scott

P.S. if this is not the appropriate forum, please point me at one more
obfuscation specific - i can't find one!
P.S.S. please save your 'why are you bothering to obfuscate' rant -
this is a commercial requirement

Thanks! :)
 
S

Scott

Doh!

I've just realised that there is a Knowledge Base article covering
just this problem in the support area once you have registered the
Community Edition...

I won't bother to post my own, less elegant solution to this problem :
(

Cheers,
Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top