Commit a0fb5b7
committed
Fix critical reflection error handling in AddRow method
**Critical Issue #3 - RESOLVED**
**Problem:**
The AddRow method was searching for Append(object) signature which doesn't exist
on DataFrame columns. DataFrame columns have strongly-typed Append methods like
Append(int?), Append(double?), etc. The previous implementation would always fail
to find the method and throw misleading error messages.
**Solution:**
DataFrameExtensionsRows.cs:34-73:
- Use BindingFlags to discover ALL Append methods on the column
- Implement intelligent 3-tier method selection strategy:
1. Exact type match (e.g., int → Append(int))
2. Nullable type match (e.g., int → Append(int?))
3. Fallback to first method (let runtime handle conversion)
- Enhanced error messages with:
- Column index for easier debugging
- Detailed type information (value type vs column type)
- Inner exception messages for better diagnostics
- Proper exception handling to avoid double-wrapping errors
**Impact:**
- AddRow now correctly handles all column types
- Clear, actionable error messages when type mismatches occur
- Proper method resolution for value types and nullable types
- No more false "does not have Append method" errors
**Testing:**
Existing tests continue to pass. This fix resolves the last critical issue
identified in the comprehensive code review.
Updated CODE_REVIEW_REPORT.md to reflect all 3 critical issues are now RESOLVED.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 30ec6ea commit a0fb5b7
2 files changed
Lines changed: 67 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
| |||
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
112 | | - | |
| 117 | + | |
113 | 118 | | |
114 | 119 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
118 | 124 | | |
119 | 125 | | |
120 | 126 | | |
| |||
140 | 146 | | |
141 | 147 | | |
142 | 148 | | |
143 | | - | |
144 | | - | |
| 149 | + | |
| 150 | + | |
145 | 151 | | |
146 | 152 | | |
147 | | - | |
148 | | - | |
| 153 | + | |
| 154 | + | |
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
| |||
158 | 164 | | |
159 | 165 | | |
160 | 166 | | |
161 | | - | |
| 167 | + | |
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
37 | 61 | | |
38 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
39 | 65 | | |
40 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
41 | 69 | | |
42 | | - | |
| 70 | + | |
43 | 71 | | |
| 72 | + | |
| 73 | + | |
44 | 74 | | |
45 | 75 | | |
46 | 76 | | |
47 | 77 | | |
48 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
49 | 81 | | |
50 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
51 | 88 | | |
52 | 89 | | |
53 | 90 | | |
54 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
55 | 94 | | |
56 | 95 | | |
57 | 96 | | |
| |||
0 commit comments