diff --git a/BeefLibs/corlib/src/Reflection/AttributeInfo.bf b/BeefLibs/corlib/src/Reflection/AttributeInfo.bf index 2ac0538c..a7f34f4f 100644 --- a/BeefLibs/corlib/src/Reflection/AttributeInfo.bf +++ b/BeefLibs/corlib/src/Reflection/AttributeInfo.bf @@ -108,6 +108,8 @@ namespace System.Reflection if (methodInfo.Invoke(targetAttr, params args) case .Ok(var val)) val.Dispose(); + else + return .Err; return .Ok; } diff --git a/BeefLibs/corlib/src/Reflection/Convert.bf b/BeefLibs/corlib/src/Reflection/Convert.bf index b6783508..693e97f2 100644 --- a/BeefLibs/corlib/src/Reflection/Convert.bf +++ b/BeefLibs/corlib/src/Reflection/Convert.bf @@ -138,6 +138,9 @@ namespace System.Reflection int64 intVal = ToInt64(obj); switch (type.[Friend]mTypeCode) { + case .Boolean: + bool val = intVal != 0; + return Variant.Create(type, &val); case .Float: float val = (.)intVal; return Variant.Create(type, &val); diff --git a/BeefLibs/corlib/src/Reflection/MethodInfo.bf b/BeefLibs/corlib/src/Reflection/MethodInfo.bf index 2b0dd4d4..dd0f170a 100644 --- a/BeefLibs/corlib/src/Reflection/MethodInfo.bf +++ b/BeefLibs/corlib/src/Reflection/MethodInfo.bf @@ -671,24 +671,28 @@ namespace System.Reflection } else if (paramType.IsValueType) { - handled = true; - if (!argType.IsBoxed) return .Err(.InvalidArgument((.)argIdx)); Type underlyingType = argType.UnderlyingType; + if (underlyingType == paramType) + handled = true; + if ((paramType.IsPrimitive) && (underlyingType.IsTypedPrimitive)) // Boxed primitive? underlyingType = underlyingType.UnderlyingType; - if (argType.IsBoxedStructPtr || argType.IsBoxedPrimitivePtr) + if ((paramType.IsTypedPrimitive) && (underlyingType.IsTypedPrimitive) && + (paramType.UnderlyingType == underlyingType.UnderlyingType)) { - dataPtr = *(void**)dataPtr; handled = true; } - else + else if (argType.IsBoxedStructPtr || argType.IsBoxedPrimitivePtr) { - isValid = underlyingType == paramType; + dataPtr = *(void**)dataPtr; } + + if (underlyingType == paramType) + handled = true; if (!handled) {