Exception After Obfuscation On Wpf Application

thesersahthesersah Posts: 2
edited October 13, 2015 8:44PM in SmartAssembly
Hello,

We have Wpf application which distibuted clients by clickonce technology. We bought SmartAseemply product for obfuscation. At our first obfuscated releae some clients take an error on appliacation init.

After some research we found exception detailk at clients eventlog. Error was thrown at AssemblyLoad event. You can find eventlog detail below(Sorry its turkish bacause of language pack)

We subscribe AssemblyLoad event to prevent from third party injectors like Snoop. You can also find code below.

After some investigation on client machines we realize .Net 4.5 Turkish Langauge pack was installed at these computers. Our opinion, system couldn't load satellite assemblies after obfuscation and we still havent found a solition yet.

Any Opinion?

Thanks for help.

Code:

public App()
{
AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
}

void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
{

if (args.LoadedAssembly.FullName.StartsWith("ManagedInjector"))
{

Application.Current.Shutdown();
}

}

Eventlog :

Description: Uygulama System.Environment.FailFast(dize ileti) kullanarak işlemi sonlandırma istedi.
Message Infinite recursion during resource lookup within mscorlib. This may be a bug in mscorlib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names. Resource name: Arg_NullReferenceException
Stack:
konum: System.Environment.FailFast(System.String, UInt32)
konum: System.Diagnostics.Assert.Fail(System.String, System.String, System.String, Int32, TraceFormat, Int32)
konum: System.Environment+ResourceHelper.GetResourceStringCode(System.Object)
konum: System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
konum: System.Environment+ResourceHelper.GetResourceString(System.String, System.Globalization.CultureInfo)
konum: System.Environment+ResourceHelper.GetResourceString(System.String)
konum: System.Environment.GetResourceStringLocal(System.String)
konum: System.Environment.GetResourceFromDefault(System.String)
konum: System.NullReferenceException..ctor()
konum: Seneka.Ebdys.Client.Host.App.CurrentDomain_AssemblyLoad(System.Object, System.AssemblyLoadEventArgs)
konum: System.AppDomain.OnAssemblyLoadEvent(System.Reflection.RuntimeAssembly)
konum: System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
konum: System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(System.String, System.Globalization.CultureInfo, System.Version, Boolean, System.Threading.StackCrawlMark ByRef)
konum: System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(System.Globalization.CultureInfo, System.Threading.StackCrawlMark ByRef)
konum: System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(System.Globalization.CultureInfo, System.Collections.Generic.Dictionary`2<System.String,System.Resources.ResourceSet>, Boolean, Boolean, System.Threading.StackCrawlMark ByRef)
konum: System.Resources.ResourceManager.InternalGetResourceSet(System.Globalization.CultureInfo, Boolean, Boolean, System.Threading.StackCrawlMark ByRef)
konum: System.Resources.ResourceManager.InternalGetResourceSet(System.Globalization.CultureInfo, Boolean, Boolean)
konum: System.Resources.ResourceManager.GetString(System.String, System.Globalization.CultureInfo)
konum: System.Environment+ResourceHelper.GetResourceStringCode(System.Object)
konum: System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
konum: System.Environment+ResourceHelper.GetResourceString(System.String, System.Globalization.CultureInfo)
konum: System.Environment+ResourceHelper.GetResourceString(System.String)
konum: System.Environment.GetResourceStringLocal(System.String)
konum: System.Environment.GetResourceFromDefault(System.String)
konum: System.NullReferenceException..ctor()
konum: Seneka.Ebdys.Client.Host.App.CurrentDomain_AssemblyLoad(System.Object, System.AssemblyLoadEventArgs)
konum: System.AppDomain.OnAssemblyLoadEvent(System.Reflection.RuntimeAssembly)
konum: System.Reflection.RuntimeAssembly.nLoadImage(Byte[], Byte[], System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, Boolean, System.Security.SecurityContextSource)
konum: System.Reflection.Assembly.Load(Byte[])
konum: ..(System.Object, System.ResolveEventArgs)
konum: System.AppDomain.OnAssemblyResolveEvent(System.Reflection.RuntimeAssembly, System.String)
konum: System.ModuleHandle.ResolveMethod(System.Reflection.RuntimeModule, Int32, IntPtr*, Int32, IntPtr*, Int32)
konum: System.ModuleHandle.ResolveMethodHandleInternalCore(System.Reflection.RuntimeModule, Int32, IntPtr[], Int32, IntPtr[], Int32)
konum: System.ModuleHandle.ResolveMethodHandleInternal(System.Reflection.RuntimeModule, Int32, System.RuntimeTypeHandle[], System.RuntimeTypeHandle[])
konum: SmartAssembly.HouseOfCards.MemberRefsProxy.CreateMemberRefsDelegates(Int32)
konum: ..cctor()
konum: Seneka.Ebdys.Client.Host.App.CurrentDomain_AssemblyLoad(System.Object, System.AssemblyLoadEventArgs)
konum: System.AppDomain.OnAssemblyLoadEvent(System.Reflection.RuntimeAssembly)
konum: System.ModuleHandle.ResolveMethod(System.Reflection.RuntimeModule, Int32, IntPtr*, Int32, IntPtr*, Int32)
konum: System.ModuleHandle.ResolveMethodHandleInternalCore(System.Reflection.RuntimeModule, Int32, IntPtr[], Int32, IntPtr[], Int32)
konum: System.ModuleHandle.ResolveMethodHandleInternal(System.Reflection.RuntimeModule, Int32, System.RuntimeTypeHandle[], System.RuntimeTypeHandle[])
konum: SmartAssembly.HouseOfCards.MemberRefsProxy.CreateMemberRefsDelegates(Int32)
konum: ..cctor()
konum: Seneka.Ebdys.Client.Host.App.CurrentDomain_AssemblyLoad(System.Object, System.AssemblyLoadEventArgs)
konum: System.AppDomain.OnAssemblyLoadEvent(System.Reflection.RuntimeAssembly)

Comments

  • Jessica RJessica R Posts: 1,256 Rose Gold 4
    Hi there,

    Thanks for your post and sorry to hear you're experiencing an issue with your protected assembly!

    We haven't seen SmartAssembly cause this error before, so I'm unfortunately not sure yet what's causing it. Can I please check--are you protecting the satellite assemblies themselves? (I'm afraid that the satellite assemblies cannot be obfuscated, resource compressed/encrypted, string-encoded, or merged/embedded to the main assembly.)

    If not, can you kindly try disabling all protection options and then re-enabling one-by-one, rebuilding in SmartAssembly and testing each time until the error returns? That will hopefully narrow down which particular feature is causing this. I suspect it may be either an embedded dependency or the resources encryption option--please let me know!

    Thank you,

    Jessica Ramos

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Sign In or Register to comment.