1

I am trying to use Obfuscar on an asp.net app (C# .Net 4)

So I want to obfusc only one dll. This dll MyApp.Secure.dll is loaded on application start by global.asax

When my dll is not obfuscated everything works fine but if it is obfusacted I encounter an error

[TypeLoadException: Could not load type 'MyApp.Secure.Securilizer' from assembly 'MyApp.Secure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.]
 MyApp.PL.Global..ctor() in c:\Users\me\Desktop\myapp\MyApp.PL\Global.asax.cs:12
ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary  ASP.NET Files\analytics\a055a403\d63b5acc\App_global.asax.zykrw1d6.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +159
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +256
System.Activator.CreateInstance(Type type, Boolean nonPublic) +127
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +14259449
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +200
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +83
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +312
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968244
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12807949

I use a very simple config file with obfuscar2.0rc7

<?xml version="1.0"?>
<Obfuscator>
  <Var name="InPath" value="MyApp.Secure\bin\Release" />
  <Var name="OutPath" value="MyApp.PL\bin" /> 

  <Module file="$(InPath)\MyApp.Secure.dll" />
</Obfuscator>

Have I done something wrong?

EDIT : Can you tell me how can I debug it, please ?

8
  • 1
    Obfuscation can affect serialization, so you'd better skip serialization related classes.
    – Lex Li
    Jun 5, 2014 at 11:48
  • I didn't use serialization in this dll or in a dll linked to/used by this one.
    – Kaly
    Jun 5, 2014 at 12:06
  • Can you tell me how can I debug it, please ?
    – Kaly
    Jun 5, 2014 at 13:41
  • It is an open source project, so why not spend some time on the code base?
    – Lex Li
    Jun 6, 2014 at 0:16
  • 2
    For others to refer to, the cause of the issue can be found at obfuscar.codeplex.com/wikipage?title=FAQ
    – Lex Li
    Apr 19, 2015 at 13:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.