I have an FTP exception thrown from a third-party assembly which is quite generic:
Exception of type 'JSchToCSharp.SharpSsh.jsch.SftpException' was thrown.
On inspection of the Exception, I see there is a private/internal member called message (lower-case m) that contains my error message:
How can I get the value of this message member?
I have tried to use reflection to get it but null is returned from GetValue:
BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic
| BindingFlags.Static;
FieldInfo field = type.GetField(fieldName, bindFlags);
var value = field.GetValue(instance);
return value.ToString();
It doesn't appear to be Non-Public or Static so I'm a little unsure as to what to use as my BindingFlags.
Thanks
Aucun commentaire:
Enregistrer un commentaire