Obfuscation Issues

Good morning Alexie

I have coded up part requirement using Aspose.Powerpoint but regrettably it causes the obfuscation tools to fail.

The exact error is

Error encountered while loading module (C:\BUILD\Product\bin\Release\Aspose.PowerPoint.dll). Index was outside the bounds of the array.


Have this scenario been encountered before?

Superfly had similar problem.
Please check:
https://forum.aspose.com/t/xenocode-linking/109985

That link does not work, but I had a look at Superfly’s posts.

Are you talking about the PeKind flag and Assembly Merging post?.

If I try your link it it comes back with “Either this forum does not exist or you are not allowed to post.”

Quick Note
https://forum.aspose.com/t/xenocode-linking/109985 is a private post and it can be seen by SuperFly and Aspose staff only. Sorry for that.

There is definitely a problem with this component and it is quite urgent to us.

When feeding Apose.dll into FXCop it throws up the same internal error, but with hopefully more useful information for you. This can be tested as fxcop is downloadable. Just add in the powerpoint assembly and the error will happen.


1 exceptions occurred while loading Aspose.PowerPoint.
0) bad CustomAttributeType encoded token
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
Index was outside the bounds of the array.
at Microsoft.Tools.FxCop.Sdk.Introspection.RuleUtilities.IsCallableFromUnmanagedCode(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.PerformanceRuleUtilities.IsDeadCode(Method method, Int32ObjectHashtable table)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.CheckMethod(Method method)
at Microsoft.Tools.FxCop.Rules.Performance.AvoidUncalledPrivateCode.Check(Member member)
at Microsoft.Tools.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target)
1 exceptions occurred while loading Aspose.PowerPoint.
0) bad CustomAttributeType encoded token


-----




Ah maybe explain a little further.

FXCop is a static code analysis tool that is one input to obtaining Microsoft Competency Certification (ISV). Its downloadable from Microsoft.

---

also was there something in that link that has been disabled that would be useful in progressing with this issue.

I'd really appreciate some answers

Kind Regards
Cor Duiker

Dear Cor,

Really, it’s absolutely normal.
Aspose.PowerPoint.dll is obfuscated and has protection against disassembling.

Link contains info that Xenocode obfuscator’s support promised to add new options
in the next versions which will allow assemblies to be loaded/linked by their end-users.

Right, this is now solved.

Incase others have similar issues here is what we’ve done.

As previously mentioned the Aspose.Powerpoint.dll contains code against disassembling. This causes problems with those tools that use the NET disassembler ILDASM.

Our obfuscator is one of those tools.

If you come across this problem the solution is

1) Do not obfuscate your code.

or

2) Remove the Aspose.Powerpoint.dll reference from your project.
Create a new library, lets call it PPUtils
This library is NOT obfuscated
Add a reference to Aspose.Powerpoint.dll into PPUtils.
And now add whatever methods you need in your app OR
move some of your code into PPUTils (but realise you can’t obfuscate
whatever code you move into this library)