Apparatus.AOT.Reflection
Apparatus.AOT.Reflection copied to clipboard
Can you add GetMethods()
I was wondering if you could have a generic way to solve:
public Frame(StackFrame? frame)
{
_methodBase = frame.GetMethod();
}
When you look at the inplementation you can see that it's not available in IOT
///
```
if (exception is not null && exception.GetType().Name.Equals("SqlException", StringComparison.OrdinalIgnoreCase)) { #pragma warning disable IL2075 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations. var props = GetExceptionTypeWithProperties(exception).GetProperties(BindingFlags.Public | BindingFlags.Instance); #pragma warning restore IL2075 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.
foreach (var property in props)
{
//sqlException
switch (property.Name)
{
case "Procedure":
_sqlProcedureName = property.GetValue(exception) as string;
break;
case "LineNumber":
if (property.GetValue(exception) is int iSqlLineNumber)
_sqlLineNumber = iSqlLineNumber;
break;
case "Number":
if (property.GetValue(exception) is int iSqlErrorNumber)
_sqlErrorNumber = iSqlErrorNumber;
break;
case "Server":
_sqlServer = property.GetValue(exception) as string;
break;
case "Source":
_tSql = property.GetValue(exception) as string;
break;
case "ErrorCode":
if (property.GetValue(exception) is int iSqlErrorCode)
_sqlErrorCode = iSqlErrorCode;
break;
}
}
}
SqlException comes from more than one namespace and in my lib I do not reference any of them but I am still interested in sending crash diagnostics without having to write a special resolver for it.