Home - Forums-.NET - Spices.Net - Problem referencing dll after obfuscation

Spices.Net

NET code security, tools to protect, obfuscate, tamper defense, code and data safety, recover, convert, optimize, explore, browse and analyze .Net software.

This forum related to following products: Spices.Net Suite, Spices.Net Obfuscator, Spices.Net Decompiler

Problem referencing dll after obfuscation
Link Posted: 09-Nov-2006 23:14
After obfuscation and resigning an assembly. when trying to add the dll to my visual studio toolbox i get an error
\"Binary format of the specified custom attribute was invalid\"

and it does not add the controls to the toolbox
Link Posted: 13-Nov-2006 00:38
Seems that some arguments of attached to main class attributes were obfuscated.
To solve this problem please mark classes used in design-time attributes as arguments as excluded (use NotObfuscateAttribute) or manually exclude these clases from obfuscation.

For example:
[c#]
[ToolboxItem(typeof(MyControlTbItem))]
[DesignerAttribute(\"MyCompany.MyControlDesigner, MyCompany.MyControl.Design\")]
[LicenseProvider(typeof(MyControlLicenseProvider))]
public class MyControl : Control, ISupportInitialize, IServiceProvider
{
  //
}

//marked as excluded from obfuscation
[NineRays.Obfuscator.NotObfuscate]
[Serializable()]
public class MyControlTbItem : ToolboxItem
{
  public MyControlTbItem() : base()
  {
    //....
  }
}

//marked as excluded from obfuscation
[NineRays.Obfuscator.NotObfuscate]
public class MyControlDesigner : System.Windows.Forms.Design.ControlDesigner
{
  //...
}

//marked as excluded from obfuscation
[NineRays.Obfuscator.NotObfuscate]  
internal class MyControlLicenseProvider : System.ComponentModel.LicenseProvider
{
  //...
}
Link Posted: 13-Nov-2006 00:51
Ok if i do this thought then NineRays namespace will appear inside my assembly if it was reflected. Is there another way to product the same result without having to add that namespace and class to my code?
Link Posted: 13-Nov-2006 01:00
There are following ways to solve this problem:
1. You can useSpices.Project.ExclusionPatterns collection or Spices.Project.Excludes collections of Spices.Project to specify classes for exclusion.
2. Change visiblity of design-time classes to the public (think that you excluding public members from obfuscation).
Link Posted: 13-Nov-2006 01:09
Ok thank you. hopefully this should solve my issue