Comments
4 comments
-
Note: The stack trace in Windows Event Viewer was actually obfuscated. I posted the decoded stack trace in my post above.
-
We have narrowed the problem down to one of the string encoding options — UseImprovedEncoding.<StringsEncoding Compress="0" Encode="0" UseCache="0" UseImprovedEncoding="0" /> works
<StringsEncoding Compress="0" Encode="1" UseCache="0" UseImprovedEncoding="0" /> works
<StringsEncoding Compress="0" Encode="1" UseCache="1" UseImprovedEncoding="0" /> works
<StringsEncoding Compress="0" Encode="1" UseCache="1" UseImprovedEncoding="1" /> fails
<StringsEncoding Compress="1" Encode="1" UseCache="1" UseImprovedEncoding="0" /> works
This feature is presented in the SA7 UI as:> You can improve protection by dynamically binding the encoded strings to the assembly structure. This prevents modification of the assembly.> [x] I want to use strings encoding with improved protection.> This feature protects against assembly modification; you will not be able to post-process the built assembly.Any ideas as to what we should do next, Redgate folks? We would prefer to be able to use that setting. Do we need to provide a tiny sample program, or is there enough info here already to provide some guidance? -
More context
We have a WPF app which uses SmartAssembly as obfuscation framework for a long time already. It worked OK until last commit introduced this strange "IndexOutOfRangeException" during application startup. We tried to gradually reduce the lines of code in the last commit to find out the smallest possible piece of code which causes our app to crash.
So, here are some code snippets that cause our app to crash when added.
Note: We tried to decorate this method with [DoNotObfuscate] attribute, but it was not making any difference. There are no strings in this method, so we are quite surprised that this is causing "StringsEncoding" with "UseImprovedEncoding" to fail.
Note 2: The method also was called from another method in this static class.
Note 3: We tried to reproduce the issue with the help of a simple console application but we didn't succeed. But we are able to create a successful build with SmartAssembly 7.5 Pro if we exclude this method from the source code.public static void VisitEntriesRecursive(CFStorage storage, Action<CFItem> itemAction, List<CFStorage> substorages = null) { storage.VisitEntries(item => { itemAction(item); }, false); }
Also here are some code snippets which DO NOT cause our app to crash.}
public static void VisitEntriesRecursive(CFStorage storage, Action<CFItem> itemAction, List<CFStorage> substorages = null) { List<string> localSubstorages = new List<string>(); storage.VisitEntries(item => { if (item.IsStorage) { localSubstorages.Add(storage.Name); } }, false);public static void VisitEntriesRecursive(CFStorage storage, Action<CFItem> itemAction, List<CFStorage> substorages = null) { storage.VisitEntries(itemAction(item), false); }
public static void VisitEntriesRecursive(CFStorage storage, Action<CFItem> itemAction, List<CFStorage> substorages = null) { storage.VisitEntries(item => { }, false); }
}
public static void VisitEntriesRecursive(CFStorage storage, Action<CFItem> itemAction, List<CFStorage> substorages = null) { storage.VisitEntries(item => { if (item.IsStorage) { var storageItem = (CFStorage)item; storage.Name?.Substring(); } }, false); -
Hi, Redgate. One or two people on my team posted comments here but they're not showing up. Are they stuck in a moderation bucket?
Add comment
Please sign in to leave a comment.
We've been using SA7 for a couple months with no problems. We used SA6 before that for years and it has gone fine.
Application: OurProductName.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IndexOutOfRangeException
at SmartAssembly.StringsEncoding.Strings.GetFromResource(Int32)
at SmartAssembly.StringsEncoding.Strings.GetCachedOrResource(Int32)
at DynamicClass.(Int32)
at OurName.OurProductName.Wpf.UI.App.InitializeComponent()
at OurName.OurProductName.Wpf.UI.App.Main()