Hi, guys,
Recently I got back to one of my projects and discovered that I'm
still stuck on getting the list of types that a given type depends on.
I came up with a method that analyses the following stuff to get this
list:
1. BaseType
2. CustomAttributes
3. FieldDefinitions
4. Method Body (analyzing instruction operands)
5. Method Parameters
For the following simple test-case I get the following output:
Test-case:
[CLSCompliant(true)]
public class test:AccessViolationException
{
private String s;
public test()
{
Random r = new Random();
}
public Type TTT(TypeCode code)
{
return null;
}
}
Output:
System.AccessViolationException
System.CLSCompliantAttribute
System.String
System.Type
System.TypeCode
System.Random
System.Void
But, for example, the well known NDepend tool comes up with the
following output (CQL - SELECT TYPES WHERE IsDirectlyUsedBy
"test.test"):
AccessViolationException
CLSComplianAttribute
ClassInterfaceAttribute
ComdefaultInterfaceAttribute
ComVisibleAttribute
Exception
GuidAttribute
ISerializable
InterfaceTypeAttribute
Object
Random
String
SystemException
Type
TypeCode
Void
_Exception
Have I missed something, or NDepend is listing something that actually
is not "directly" referenced by the give type.
Thanks in advance,
Lev
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---