Home - Forums-.NET - Spices.Net - RuntimeBinderException

Spices.Net

NET code security, tools to protect, obfuscate, tamper defense, code and data safety, recover, convert, optimize, explore, browse and analyze .Net software.

This forum related to following products: Spices.Net Suite, Spices.Net Obfuscator, Spices.Net Decompiler

RuntimeBinderException
Link Posted: 20-Jun-2011 15:06
Hi,

I'm getting the following error 'after' obfuscating the C# application I have.

Exception Information:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'CMConvert.XMLConvert' does not contain a definition for 'GetInvPercentages'

Obfucation options:

{Anonymizer=High}{AntiILDASM=CompleteImproved}{StringEncryptionMode=Encrypt3DES}{SoftwareWatermark=IT Retail, Inc.}

These are the exact same obfuscation options I've got in all my other obfuscated code.

I don't mind sending you the source code for you to look at if that will help determine why this isn't working. Please let me know.

Best regards,
ct
Link Posted: 20-Jun-2011 15:14
Here are the obfuscation results, which look normal:

Spices.Net Obfuscator, 5.8.0.45, 9Rays.Net (c) 2010. All rights reserved
Start obfuscating project: C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert.iloprj
Start time:2:55:16 PM

--- Checking consistency ----
Consistency checked successfully.
--- Checking consistency finished ----
---- Start preparing substitutions and excludes ----
---- Finish preparing substitutions (0 items) and excludes (0 items)----
----Start of obfuscation C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\CMConvert.exe ------------
--- Start obfuscate types of C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\CMConvert.exe
--- Start obfuscate fields of C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\CMConvert.exe
--- Start obfuscate methods of C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\CMConvert.exe
----Fixup References in C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\CMConvert.exe ----------------
File C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\CMConvert.exe successfully saved to C:\$\D\CustomProjects\Choice Mart\CMConvert\Spices_output\CMConvert.exe
C:\$\D\CustomProjects\Choice Mart\CMConvert\Spices_output\CMConvert.exe size before/after:390656/451072 bytes (ratio=1.15)
----Statistics for C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\CMConvert.exe ----------------
------------------------------------------------------
Obfuscation Statistics
------------------------------------------------------
Members             Assembly Obfuscation   Percentage
------------------------------------------------------
Namespaces:                6           2      33.33 %
Types:                    35           4      11.43 %
Fields:                  172          81      47.09 %
Methods:                  90          33      36.67 %
Properties:               17           0       0.00 %
Events:                    0           0       0.00 %
ManagedResource:           2           0       0.00 %
AssemblyRefs:              8           0       0.00 %
TypeRefs:                183           0       0.00 %
MemberRefs:              312           0       0.00 %
---------------Anonymizer and Encryption--------------
------------------------------------------------------
Encrypted strings:         -         484
Anonymized methods:        -          49
Method stubs:              -          20
------------------------------------------------------
MetaData Size:         27880       56290     201.90 %
------------------------------------------------------
----End of obfuscation C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\CMConvert.exe ------------
Signing of C:\$\D\CustomProjects\Choice Mart\CMConvert\Spices_output\CMConvert.exe successfully finished
Total obfuscated members 120
Finish time:2:55:31 PM
Finish obfuscating project.
Verification of assemblies:
File: C:\$\D\CustomProjects\Choice Mart\CMConvert\Spices_output\CMConvert.exe has no errors
File C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\CMConvert.exe updated.
Update files: File C:\$\D\CustomProjects\Choice Mart\CMConvert\Spices_output\cmconvert.exe copied to C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\obj\x86\Release\CMConvert.exe
Update files: File C:\$\D\CustomProjects\Choice Mart\CMConvert\Spices_output\cmconvert.exe copied to C:\$\D\CustomProjects\Choice Mart\CMConvert\CMConvert\bin\Release\cmconvert.exe
Link Posted: 20-Jun-2011 15:20
I'd recommend you to change the Anonymizer settings to {StringEncryption, StubUntouchedMethods} and change ObfuscationOptions.Members to KeepsSerialization or DefaultImproved or Full (that's better for exe's that don't use serialization).
Link Posted: 20-Jun-2011 15:35
I'm assuming that you meant for me to change StringEncryption and StubUntouchedMethods to False, as well as change Memebers to Full.

I've tried the above and the results are the same.

None of this is making any sense at the moment. Can I send you the source for you to take a look at?

Best regards,
ct
Link Posted: 20-Jun-2011 15:40
No, I meant to decrease level of anonymization and change the level from High(that's predefined) to choose (set to True) just Anonymizer.StringEncryption and Anonymizer.StubUntouchedMethods options.
Yes, you can send us your spices.project, in this case we can make changes to your project and send you changed project back.
Link Posted: 20-Jun-2011 15:51
That didn't help. I'm going to zip up and send you the code via email.

Also, please note:

The line of code that's having a problem is:

GetInvPercentages(Convert.ToString((xlRange.Cells[rCnt, 4] as Excel.Range).Value2), ref upcharge, ref margin);

The following line of code does NOT have any problems:

GetPercentages(itrDepartment, itrSection, ref upcharge, ref margin);

I wonder if it has something to do with the call to the spreadsheet. What do you think?

Best regards,
ct
Link Posted: 20-Jun-2011 16:01
Just send us the executable (original) and referenced assemblies (not system, but probably you're using 3rd party or COM assemblies).
We should take a look how calls to Excel are organized, how they use COM, to give you recommendations.
Link Posted: 20-Jun-2011 15:59
Guess what? I got it to work with my orignal settings:

{Anonymizer=High}{AntiILDASM=CompleteImproved}{StringEncryptionMode=Encrypt3DES}{SoftwareWatermark=IT Retail, Inc.}

I changed

GetInvPercentages(Convert.ToString((xlRange.Cells[rCnt, 4] as Excel.Range).Value2), ref upcharge, ref margin);

to the following:

string gl = string.Empty;
gl = Convert.ToString((xlRange.Cells[rCnt, 4] as Excel.Range).Value2);
GetInvPercentages(gl, ref upcharge, ref margin);

Now it run just fine at runtime. I'm getting no errors.

Is this an issue with Spices.Net or something that I should expect? Do you still want to see the code?

Best regards,
ct
Link Posted: 20-Jun-2011 16:04
Coud you send us the assembly with GetInvPercentages(Convert.ToString((xlRange.Cells[rCnt, 4] as Excel.Range).Value2), ref upcharge, ref margin);?
Probably Anonymizer in the process of anonymization made something that changed the code behavoir.
Link Posted: 20-Jun-2011 16:07
Sure, I'm putting an email together for you right now. You'll receive it shortly.

Best regards,
ct