.NET loses references to the dependent DLLs

Nov 19, 2012 at 9:47 AM
Edited Nov 19, 2012 at 11:56 AM

I write plug-ins for AutoCAD in a multiple of DLL files. Some of which refer to the child DLLs. References are set in the node references, so the .NET automatically takes care of the dependent DLLs to load.
When I use Confuser in a higher than normal mode, .NET loses references to the dependent DLLs. Is it possible to fix it?

Coordinator
Nov 21, 2012 at 4:12 PM

Hi,

Sorry but I don't quite understand what's the problem, is there any runtime exceptions?

Nov 21, 2012 at 5:03 PM
Edited Nov 21, 2012 at 5:10 PM

Yes. I used confuser again. This time, do not lose the reference, but it can not load the plugin. This is (in this case) in Maximum mode:

AutoCAD command: netload
Error:
Nie można wczytać zespołu. Szczegóły błędu:
System.BadImageFormatException: Nieprawidłowy token.
w System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection, Boolean suppressSecurityChecks)
w System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection, Boolean suppressSecurityChecks)
w System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile,
Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm
hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks,
StackCrawlMark& stackMark)
w System.Reflection.Assembly.LoadFrom(String assemblyFile)
w Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
w loadmgd()


In addition, antivirus (eset) "detected" viruses.

  Example plugin:
public class MyCommands
{
[CommandMethod( "nPoS", CommandFlags.DocExclusiveLock | CommandFlags.Modal | CommandFlags.UsePickSet )]
public void test2() // This method can have any name
{
}
}


where:

#region Assembly acmgd.dll, v2.0.50727
// C:\Program Files\Autodesk\AutoCAD 2012 - Polski\acmgd.dll
#endregion

using System;

namespace Autodesk.AutoCAD.Runtime
{
[AttributeUsage( AttributeTargets.Method, AllowMultiple = true, Inherited = false )]
public sealed class CommandMethodAttribute : Attribute, ICommandLineCallable
{
public CommandMethodAttribute( string globalName );
public CommandMethodAttribute( string globalName, CommandFlags flags );
public CommandMethodAttribute( string groupName, string globalName, CommandFlags flags );
public CommandMethodAttribute( string groupName, string globalName, string localizedNameId, CommandFlags flags );
public CommandMethodAttribute( string groupName, string globalName, string localizedNameId, CommandFlags flags, string helpTopic );
public CommandMethodAttribute( string groupName, string globalName, string localizedNameId, CommandFlags flags, Type contextMenuExtensionType );
public CommandMethodAttribute( string groupName, string globalName, string localizedNameId, CommandFlags flags, Type contextMenuExtensionType, string helpFileName, string helpTopic );

public virtual Type ContextMenuExtensionType
{
get;
}
public virtual CommandFlags Flags
{
get;
}
public virtual string GlobalName
{
get;
}
public virtual string GroupName
{
get;
}
public virtual string HelpFileName
{
get;
}
public virtual string HelpTopic
{
get;
}
public virtual string LocalizedNameId
{
get;
}
}
}


and:

#region Assembly mscorlib.dll, v2.0.50727
// C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll
#endregion

using System.Reflection;
using System.Runtime.InteropServices;

namespace System
{
// Summary:
// Represents the base class for custom attributes.
[Serializable]
[ComVisible( true )]
[ComDefaultInterface( typeof( _Attribute ) )]
[AttributeUsage( AttributeTargets.All, Inherited = true, AllowMultiple = false )]
[ClassInterface( ClassInterfaceType.None )]
public abstract class Attribute : _Attribute
{
// Summary:
// Initializes a new instance of the System.Attribute class.
protected Attribute();

// Summary:
// When implemented in a derived class, gets a unique identifier for this System.Attribute.
//
// Returns:
// An System.Object that is a unique identifier for the attribute.
public virtual object TypeId
{
get;
}

// Summary:
// Returns a value that indicates whether this instance is equal to a specified
// object.
//
// Parameters:
// obj:
// An System.Object to compare with this instance or null.
//
// Returns:
// true if obj equals the type and value of this instance; otherwise, false.
public override bool Equals( object obj );
//
// Summary:
// Retrieves a custom attribute applied to a specified assembly. Parameters
// specify the assembly and the type of the custom attribute to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Assembly class that describes
// a reusable collection of modules.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// A reference to the single custom attribute of type attributeType that is
// applied to element, or null if there is no such attribute.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.Reflection.AmbiguousMatchException:
// More than one of the requested attributes was found.
public static Attribute GetCustomAttribute( Assembly element, Type attributeType );
//
// Summary:
// Retrieves a custom attribute applied to a member of a type. Parameters specify
// the member, and the type of the custom attribute to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.MemberInfo class that describes
// a constructor, event, field, method, or property member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// A reference to the single custom attribute of type attributeType that is
// applied to element, or null if there is no such attribute.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.NotSupportedException:
// element is not a constructor, method, property, event, type, or field.
//
// System.Reflection.AmbiguousMatchException:
// More than one of the requested attributes was found.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute GetCustomAttribute( MemberInfo element, Type attributeType );
//
// Summary:
// Retrieves a custom attribute applied to a module. Parameters specify the
// module, and the type of the custom attribute to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Module class that describes
// a portable executable file.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// A reference to the single custom attribute of type attributeType that is
// applied to element, or null if there is no such attribute.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.Reflection.AmbiguousMatchException:
// More than one of the requested attributes was found.
public static Attribute GetCustomAttribute( Module element, Type attributeType );
//
// Summary:
// Retrieves a custom attribute applied to a method parameter. Parameters specify
// the method parameter, and the type of the custom attribute to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.ParameterInfo class that describes
// a parameter of a member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// A reference to the single custom attribute of type attributeType that is
// applied to element, or null if there is no such attribute.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.Reflection.AmbiguousMatchException:
// More than one of the requested attributes was found.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute GetCustomAttribute( ParameterInfo element, Type attributeType );
//
// Summary:
// Retrieves a custom attribute applied to an assembly. Parameters specify the
// assembly, the type of the custom attribute to search for, and an ignored
// search option.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Assembly class that describes
// a reusable collection of modules.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// This parameter is ignored, and does not affect the operation of this method.
//
// Returns:
// A reference to the single custom attribute of type attributeType that is
// applied to element, or null if there is no such attribute.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.Reflection.AmbiguousMatchException:
// More than one of the requested attributes was found.
public static Attribute GetCustomAttribute( Assembly element, Type attributeType, bool inherit );
//
// Summary:
// Retrieves a custom attribute applied to a member of a type. Parameters specify
// the member, the type of the custom attribute to search for, and whether to
// search ancestors of the member.
//
// Parameters:
// element:
// An object derived from the System.Reflection.MemberInfo class that describes
// a constructor, event, field, method, or property member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// If true, specifies to also search the ancestors of element for custom attributes.
//
// Returns:
// A reference to the single custom attribute of type attributeType that is
// applied to element, or null if there is no such attribute.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.NotSupportedException:
// element is not a constructor, method, property, event, type, or field.
//
// System.Reflection.AmbiguousMatchException:
// More than one of the requested attributes was found.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute GetCustomAttribute( MemberInfo element, Type attributeType, bool inherit );
//
// Summary:
// Retrieves a custom attribute applied to a module. Parameters specify the
// module, the type of the custom attribute to search for, and an ignored search
// option.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Module class that describes
// a portable executable file.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// This parameter is ignored, and does not affect the operation of this method.
//
// Returns:
// A reference to the single custom attribute of type attributeType that is
// applied to element, or null if there is no such attribute.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.Reflection.AmbiguousMatchException:
// More than one of the requested attributes was found.
public static Attribute GetCustomAttribute( Module element, Type attributeType, bool inherit );
//
// Summary:
// Retrieves a custom attribute applied to a method parameter. Parameters specify
// the method parameter, the type of the custom attribute to search for, and
// whether to search ancestors of the method parameter.
//
// Parameters:
// element:
// An object derived from the System.Reflection.ParameterInfo class that describes
// a parameter of a member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// If true, specifies to also search the ancestors of element for custom attributes.
//
// Returns:
// A reference to the single custom attribute of type attributeType that is
// applied to element, or null if there is no such attribute.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.Reflection.AmbiguousMatchException:
// More than one of the requested attributes was found.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute GetCustomAttribute( ParameterInfo element, Type attributeType, bool inherit );
//
// Summary:
// Retrieves an array of the custom attributes applied to an assembly. A parameter
// specifies the assembly.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Assembly class that describes
// a reusable collection of modules.
//
// Returns:
// An System.Attribute array that contains the custom attributes applied to
// element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element is null.
public static Attribute[] GetCustomAttributes( Assembly element );
//
// Summary:
// Retrieves an array of the custom attributes applied to a member of a type.
// A parameter specifies the member.
//
// Parameters:
// element:
// An object derived from the System.Reflection.MemberInfo class that describes
// a constructor, event, field, method, or property member of a class.
//
// Returns:
// An System.Attribute array that contains the custom attributes applied to
// element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element is null.
//
// System.NotSupportedException:
// element is not a constructor, method, property, event, type, or field.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute[] GetCustomAttributes( MemberInfo element );
//
// Summary:
// Retrieves an array of the custom attributes applied to a module. A parameter
// specifies the module.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Module class that describes
// a portable executable file.
//
// Returns:
// An System.Attribute array that contains the custom attributes applied to
// element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element is null.
public static Attribute[] GetCustomAttributes( Module element );
//
// Summary:
// Retrieves an array of the custom attributes applied to a method parameter.
// A parameter specifies the method parameter.
//
// Parameters:
// element:
// An object derived from the System.Reflection.ParameterInfo class that describes
// a parameter of a member of a class.
//
// Returns:
// An System.Attribute array that contains the custom attributes applied to
// element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element is null.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute[] GetCustomAttributes( ParameterInfo element );
//
// Summary:
// Retrieves an array of the custom attributes applied to an assembly. Parameters
// specify the assembly, and an ignored search option.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Assembly class that describes
// a reusable collection of modules.
//
// inherit:
// This parameter is ignored, and does not affect the operation of this method.
//
// Returns:
// An System.Attribute array that contains the custom attributes applied to
// element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
public static Attribute[] GetCustomAttributes( Assembly element, bool inherit );
//
// Summary:
// Retrieves an array of the custom attributes applied to an assembly. Parameters
// specify the assembly, and the type of the custom attribute to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Assembly class that describes
// a reusable collection of modules.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// An System.Attribute array that contains the custom attributes of type attributeType
// applied to element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
public static Attribute[] GetCustomAttributes( Assembly element, Type attributeType );
//
// Summary:
// Retrieves an array of the custom attributes applied to a member of a type.
// Parameters specify the member, the type of the custom attribute to search
// for, and whether to search ancestors of the member.
//
// Parameters:
// element:
// An object derived from the System.Reflection.MemberInfo class that describes
// a constructor, event, field, method, or property member of a class.
//
// inherit:
// If true, specifies to also search the ancestors of element for custom attributes.
//
// Returns:
// An System.Attribute array that contains the custom attributes applied to
// element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element is null.
//
// System.NotSupportedException:
// element is not a constructor, method, property, event, type, or field.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute[] GetCustomAttributes( MemberInfo element, bool inherit );
//
// Summary:
// Retrieves an array of the custom attributes applied to a member of a type.
// Parameters specify the member, and the type of the custom attribute to search
// for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.MemberInfo class that describes
// a constructor, event, field, method, or property member of a class.
//
// type:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// An System.Attribute array that contains the custom attributes of type type
// applied to element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or type is null.
//
// System.ArgumentException:
// type is not derived from System.Attribute.
//
// System.NotSupportedException:
// element is not a constructor, method, property, event, type, or field.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute[] GetCustomAttributes( MemberInfo element, Type type );
//
// Summary:
// Retrieves an array of the custom attributes applied to a module. Parameters
// specify the module, and an ignored search option.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Module class that describes
// a portable executable file.
//
// inherit:
// This parameter is ignored, and does not affect the operation of this method.
//
// Returns:
// An System.Attribute array that contains the custom attributes applied to
// element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
public static Attribute[] GetCustomAttributes( Module element, bool inherit );
//
// Summary:
// Retrieves an array of the custom attributes applied to a module. Parameters
// specify the module, and the type of the custom attribute to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Module class that describes
// a portable executable file.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// An System.Attribute array that contains the custom attributes of type attributeType
// applied to element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
public static Attribute[] GetCustomAttributes( Module element, Type attributeType );
//
// Summary:
// Retrieves an array of the custom attributes applied to a method parameter.
// Parameters specify the method parameter, and whether to search ancestors
// of the method parameter.
//
// Parameters:
// element:
// An object derived from the System.Reflection.ParameterInfo class that describes
// a parameter of a member of a class.
//
// inherit:
// If true, specifies to also search the ancestors of element for custom attributes.
//
// Returns:
// An System.Attribute array that contains the custom attributes applied to
// element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element is null.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute[] GetCustomAttributes( ParameterInfo element, bool inherit );
//
// Summary:
// Retrieves an array of the custom attributes applied to a method parameter.
// Parameters specify the method parameter, and the type of the custom attribute
// to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.ParameterInfo class that describes
// a parameter of a member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// An System.Attribute array that contains the custom attributes of type attributeType
// applied to element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute[] GetCustomAttributes( ParameterInfo element, Type attributeType );
//
// Summary:
// Retrieves an array of the custom attributes applied to an assembly. Parameters
// specify the assembly, the type of the custom attribute to search for, and
// an ignored search option.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Assembly class that describes
// a reusable collection of modules.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// This parameter is ignored, and does not affect the operation of this method.
//
// Returns:
// An System.Attribute array that contains the custom attributes of type attributeType
// applied to element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
public static Attribute[] GetCustomAttributes( Assembly element, Type attributeType, bool inherit );
//
// Summary:
// Retrieves an array of the custom attributes applied to a member of a type.
// Parameters specify the member, the type of the custom attribute to search
// for, and whether to search ancestors of the member.
//
// Parameters:
// element:
// An object derived from the System.Reflection.MemberInfo class that describes
// a constructor, event, field, method, or property member of a class.
//
// type:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// If true, specifies to also search the ancestors of element for custom attributes.
//
// Returns:
// An System.Attribute array that contains the custom attributes of type type
// applied to element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or type is null.
//
// System.ArgumentException:
// type is not derived from System.Attribute.
//
// System.NotSupportedException:
// element is not a constructor, method, property, event, type, or field.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute[] GetCustomAttributes( MemberInfo element, Type type, bool inherit );
//
// Summary:
// Retrieves an array of the custom attributes applied to a module. Parameters
// specify the module, the type of the custom attribute to search for, and an
// ignored search option.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Module class that describes
// a portable executable file.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// This parameter is ignored, and does not affect the operation of this method.
//
// Returns:
// An System.Attribute array that contains the custom attributes of type attributeType
// applied to element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
public static Attribute[] GetCustomAttributes( Module element, Type attributeType, bool inherit );
//
// Summary:
// Retrieves an array of the custom attributes applied to a method parameter.
// Parameters specify the method parameter, the type of the custom attribute
// to search for, and whether to search ancestors of the method parameter.
//
// Parameters:
// element:
// An object derived from the System.Reflection.ParameterInfo class that describes
// a parameter of a member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// If true, specifies to also search the ancestors of element for custom attributes.
//
// Returns:
// An System.Attribute array that contains the custom attributes of type attributeType
// applied to element, or an empty array if no such custom attributes exist.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.TypeLoadException:
// A custom attribute type cannot be loaded.
public static Attribute[] GetCustomAttributes( ParameterInfo element, Type attributeType, bool inherit );
//
// Summary:
// Returns the hash code for this instance.
//
// Returns:
// A 32-bit signed integer hash code.
public override int GetHashCode();
//
// Summary:
// When overridden in a derived class, indicates whether the value of this instance
// is the default value for the derived class.
//
// Returns:
// true if this instance is the default attribute for the class; otherwise,
// false.
public virtual bool IsDefaultAttribute();
//
// Summary:
// Determines whether any custom attributes are applied to an assembly. Parameters
// specify the assembly, and the type of the custom attribute to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Assembly class that describes
// a reusable collection of modules.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// true if a custom attribute of type attributeType is applied to element; otherwise,
// false.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
public static bool IsDefined( Assembly element, Type attributeType );
//
// Summary:
// Determines whether any custom attributes are applied to a member of a type.
// Parameters specify the member, and the type of the custom attribute to search
// for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.MemberInfo class that describes
// a constructor, event, field, method, type, or property member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// true if a custom attribute of type attributeType is applied to element; otherwise,
// false.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.NotSupportedException:
// element is not a constructor, method, property, event, type, or field.
public static bool IsDefined( MemberInfo element, Type attributeType );
//
// Summary:
// Determines whether any custom attributes of a specified type are applied
// to a module. Parameters specify the module, and the type of the custom attribute
// to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Module class that describes
// a portable executable file.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// true if a custom attribute of type attributeType is applied to element; otherwise,
// false.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
public static bool IsDefined( Module element, Type attributeType );
//
// Summary:
// Determines whether any custom attributes are applied to a method parameter.
// Parameters specify the method parameter, and the type of the custom attribute
// to search for.
//
// Parameters:
// element:
// An object derived from the System.Reflection.ParameterInfo class that describes
// a parameter of a member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// Returns:
// true if a custom attribute of type attributeType is applied to element; otherwise,
// false.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
public static bool IsDefined( ParameterInfo element, Type attributeType );
//
// Summary:
// Determines whether any custom attributes are applied to an assembly. Parameters
// specify the assembly, the type of the custom attribute to search for, and
// an ignored search option.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Assembly class that describes
// a reusable collection of modules.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// This parameter is ignored, and does not affect the operation of this method.
//
// Returns:
// true if a custom attribute of type attributeType is applied to element; otherwise,
// false.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
public static bool IsDefined( Assembly element, Type attributeType, bool inherit );
//
// Summary:
// Determines whether any custom attributes are applied to a member of a type.
// Parameters specify the member, the type of the custom attribute to search
// for, and whether to search ancestors of the member.
//
// Parameters:
// element:
// An object derived from the System.Reflection.MemberInfo class that describes
// a constructor, event, field, method, type, or property member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// If true, specifies to also search the ancestors of element for custom attributes.
//
// Returns:
// true if a custom attribute of type attributeType is applied to element; otherwise,
// false.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.NotSupportedException:
// element is not a constructor, method, property, event, type, or field.
public static bool IsDefined( MemberInfo element, Type attributeType, bool inherit );
//
// Summary:
// Determines whether any custom attributes are applied to a module. Parameters
// specify the module, the type of the custom attribute to search for, and an
// ignored search option.
//
// Parameters:
// element:
// An object derived from the System.Reflection.Module class that describes
// a portable executable file.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// This parameter is ignored, and does not affect the operation of this method.
//
// Returns:
// true if a custom attribute of type attributeType is applied to element; otherwise,
// false.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
public static bool IsDefined( Module element, Type attributeType, bool inherit );
//
// Summary:
// Determines whether any custom attributes are applied to a method parameter.
// Parameters specify the method parameter, the type of the custom attribute
// to search for, and whether to search ancestors of the method parameter.
//
// Parameters:
// element:
// An object derived from the System.Reflection.ParameterInfo class that describes
// a parameter of a member of a class.
//
// attributeType:
// The type, or a base type, of the custom attribute to search for.
//
// inherit:
// If true, specifies to also search the ancestors of element for custom attributes.
//
// Returns:
// true if a custom attribute of type attributeType is applied to element; otherwise,
// false.
//
// Exceptions:
// System.ArgumentNullException:
// element or attributeType is null.
//
// System.ArgumentException:
// attributeType is not derived from System.Attribute.
//
// System.ExecutionEngineException:
// element is not a method, constructor, or type.
public static bool IsDefined( ParameterInfo element, Type attributeType, bool inherit );
//
// Summary:
// When overridden in a derived class, returns a value that indicates whether
// this instance equals a specified object.
//
// Parameters:
// obj:
// An System.Object to compare with this instance of System.Attribute.
//
// Returns:
// true if this instance equals obj; otherwise, false.
public virtual bool Match( object obj );
}
}


 

2012/11/21 yck1509 <notifications@codeplex.com>

From: yck1509

Hi,

Sorry but I don't quite understand what's the problem, is there any runtime exceptions?

Read the full discussion online.

To add a post to this discussion, reply to this email (Confuser@discussions.codeplex.com)

To start a new discussion for this project, email Confuser@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Nov 24, 2012 at 3:52 AM

I guess you used the Invalid Metadata obfuscation. This one will prevent reflection from functioning properly. Please try disabling it.

Nov 26, 2012 at 7:02 AM
Edited Nov 26, 2012 at 11:08 AM

In the "Advanced" I have for each of 65 DLL check "Override default settings" and uncheck "Invalid metadata obfuscation"? Is it possible to do this multiple? I write new DLLs, in the future it may be a problem.

Nov 26, 2012 at 9:45 AM
Edited Dec 2, 2012 at 12:00 PM

In the "Advanced settings" I set the selected DLL everything except "Invalid metadata confusion". It works, but in some cases Autocad crashes when Control Flow Confusion is used (System.BadImageFormatException: It was expected that the module will contain the assembly manifest. (Exception from HRESULT: 0x80131018)).
Please only append functionality to change settings for the multiple DLLs. In this way I will be able to select the appropriate options for my needs. Please also append functionality to select folder with external assemblies (to not have to copy them to my DLLs). If the folder is not set and is required, let's ask.

P.S.
Please keep checking the forum frequently.