Skip to content

Commit 755d75e

Browse files
committed
Dumper hack
1 parent ee750b0 commit 755d75e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

IronPythonModule/IPPlugin.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,22 @@ public void DumpPropsToFile(string path, object obj) {
109109
string nuline = "\r\n";
110110

111111
if (obj is AppDomain)
112-
objprops = "Public properties of appDomain: " + ((AppDomain)obj).FriendlyName + nuline + nuline;
112+
objprops = "Appdomain.FriendlyName: " + ((AppDomain)obj).FriendlyName + nuline + nuline;
113113
else
114-
objprops = "Public properties of: " + obj.GetType() + nuline + nuline;
114+
objprops = "Type: " + obj.GetType() + nuline + nuline;
115115

116116
PropertyInfo[] pInfos = obj.GetType().GetProperties();
117117

118+
string name;
119+
string value;
120+
118121
foreach (PropertyInfo pInfo in pInfos) {
119-
objprops += pInfo.Name + " = " + pInfo.GetValue (obj, null).ToString () + nuline;
122+
try { name = pInfo.Name; } catch (Exception ex) { name = ex.Message; }
123+
try { value = pInfo.GetValue(obj, null).ToString(); } catch (Exception ex) { value = ex.Message; }
124+
objprops += name + " = " + value + nuline;
120125
}
121126

122-
File.AppendAllText (path, objprops + nuline);
127+
File.AppendAllText(path, objprops + nuline);
123128
}
124129

125130
public void DeleteLog(string path) {

0 commit comments

Comments
 (0)