Obfuscated code problem

B

Bry

I'm trying Obfuscation for the first time using the community edition
of dotfuscator that ships with vs .net 2005.

After building my code, I load the compiled .exe into dotfuscator and
let it run. When I try to execute the obfuscated code, I received an
exception. When I debug using vs .net, It reports the following
exception.

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

I assume i am missing something obvious, can anyone help?

Thanks,
Bry.
 
G

Guest

Hi Bry,
are you running this app in a different language/culture login for the OS
that what you used to develop. Probably the culture of the main thread is
set to a culture for which you don't have a resource file, try putting
something like this in your main load method:

System.Threading.Thread.CurrentThread.CurrentUICulture =
System.Globalization.CultureInfo.CreateSpecificCulture("en-us");

or whatever culture your app was created using, you should not have this
problem after doing that.

Hope that helps
Mark R Dawson
http://www.markdawson.org
 
S

SP

Bry said:
I'm trying Obfuscation for the first time using the community edition
of dotfuscator that ships with vs .net 2005.

After building my code, I load the compiled .exe into dotfuscator and
let it run. When I try to execute the obfuscated code, I received an
exception. When I debug using vs .net, It reports the following
exception.

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

I assume i am missing something obvious, can anyone help?

It may not be something obvious. I recently had a very similar error
occuring because a third party control was causing an exception which was
causing a message box to display. The message box required culture info and
the error manifested with the same "resources" error. It could be that you
have "over" obfuscated and are getting an error because of this. Do you use
reflection or have any code where the type's name is used for comparison
like GetType.ToString() == "MyType".

SP
 
B

Bry

Thanks for the info.

Mark : I've tried adding the line you suggested, but I still receive
the same error.

SP : Interesting point about the type name, I presume obfuscation can't
deal with this?
From the info you have both supplied, I thought it would be worth
trying to add some rename exclusions, so I worked through all the
options, running the obfuscation and then trying the code. I found the
section that the obfuscation was causing a problem with, and drilled
down deeper until I got to the lowest level. I have now excluded that
part from obfuscation. For information, the part of my code I had to
exclude was

TestApp.Exe
+-TestApp.Properties
+-Resources

There is nothing in this part of the code that I really want to
obfuscate.

Many thanks for your help.
 
F

Frans Bouma [C# MVP]

Bry said:
I'm trying Obfuscation for the first time using the community edition
of dotfuscator that ships with vs .net 2005.

After building my code, I load the compiled .exe into dotfuscator and
let it run. When I try to execute the obfuscated code, I received an
exception. When I debug using vs .net, It reports the following
exception.

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

I assume i am missing something obvious, can anyone help?

with obfuscation, always exclude nested types and properties which are
bound to controls and also resources which you use in a named fashion.
This is because the names change after obfuscation, so at runtime the
elements have different names but your code refers to them with the old
names.

Frans

--
 

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