Obfuscar 2.0 - Could not load type from assembly

2.6k Views Asked by At

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 ?

0

There are 0 best solutions below