Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ILRuntime/CLR/Method/ILMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public List<IType> Parameters
{
get
{
if (def.HasParameters && parameters == null)
if (def.HasParameters || parameters == null)
{
InitParameters();
}
Expand Down
13 changes: 12 additions & 1 deletion ILRuntime/Reflection/ILRuntimeMethodInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,22 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
List<Attribute> res = new List<Attribute>();
for (int i = 0; i < customAttributes.Length; i++)
{
if (attributeTypes[i].Equals(attributeType))
if (attributeTypes[i].Equals(attributeType)||(inherit&&(attributeType.IsAssignableFrom(attributeTypes[i])||attributeTypes[i].BaseType!=null&&attributeType.IsAssignableFrom(attributeTypes[i].BaseType))))
res.Add(customAttributes[i]);
}
return res.ToArray();
}
public Object GetCustomAttribute ( Type oType, Boolean inherit ) => this.GetCustomAttributes ( oType, inherit ).FirstOrDefault ();
public T GetCustomAttribute<T> ( Boolean inherit ) where T : System.Attribute => this.GetCustomAttributes<T> ( inherit ).FirstOrDefault ();
public T [] GetCustomAttributes<T> ( Boolean inherit ) where T : System.Attribute
{
IList<T> aDataList = new List<T> ();
foreach ( T attribute in this.GetCustomAttributes ( inherit ) )
{
aDataList.Add ( attribute );
}
return aDataList.ToArray ();
}

public override MethodImplAttributes GetMethodImplementationFlags()
{
Expand Down
2 changes: 1 addition & 1 deletion ILRuntime/Runtime/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public static bool MatchGenericParameters(this Type[] args, Type type, Type q, T
if (q.IsGenericType)
{
var t1 = type.GetGenericTypeDefinition();
var t2 = type.GetGenericTypeDefinition();
var t2 = q.GetGenericTypeDefinition();
if (t1 == t2)
{
var argA = type.GetGenericArguments();
Expand Down