[Debugger] Handle open generic types in probe expressions#8569
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48005dc6bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
BenchmarksBenchmark execution time: 2026-05-11 13:37:50 Comparing candidate commit c812ed8 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 0 unstable metrics, 60 known flaky benchmarks, 27 flaky benchmarks without significant changes.
|
… clearer error message
AddParameterAndVariable now closes a generic type definition by substituting
object for any reference-type argument. If a generic argument is a value type,
throw InvalidOperationException with a clear message instead of crashing later
in Expression.Variable / MakeGenericType.
ProbeExpressionParser.Binary: when a binary comparison throws
InvalidOperationException because one side is a value type and the other is a
reference type, report a friendly error ('A reference type cannot be compared
to a not nullable value type.') with a hint about using 'default' instead of
'null' when one side is the null constant.
Also drop an unused IbmMq using directive that was leaked into this file.
Co-authored-by: Cursor <[email protected]>
Close open generic scope member types during expression compilation, including constructed generics such as IEnumerable<T>, and return clear evaluation errors for unsupported value-type generic parameters.
48005dc to
119bbbd
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 119bbbdfca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var error = e.Message; | ||
| if (e is InvalidOperationException) | ||
| { | ||
| if ((left?.Type?.IsValueType == true && right?.Type?.IsValueType == false) |
There was a problem hiding this comment.
for && right?.Type?.IsValueType == false it means that if right or right.Type` is null, the condition will be true and will it be misleading?
There was a problem hiding this comment.
No, but it's still worth clarifying. ed7e753
Only rewrite reference/value comparison errors when the value side is non-nullable, and add coverage for nullable value type comparisons so Nullable<T> keeps its original expression-tree behavior.
Track generic parameters while closing open generic types so self-referential constraints return an evaluation error instead of recursing indefinitely. Add coverage for `where T : IComparable<T>`.
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8569) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8569) - mean (75ms) : 71, 79
master - mean (75ms) : 71, 80
section Bailout
This PR (8569) - mean (79ms) : 75, 83
master - mean (78ms) : 75, 82
section CallTarget+Inlining+NGEN
This PR (8569) - mean (1,125ms) : 1078, 1172
master - mean (1,125ms) : 1071, 1179
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8569) - mean (117ms) : 111, 123
master - mean (115ms) : 108, 123
section Bailout
This PR (8569) - mean (115ms) : 112, 118
master - mean (115ms) : 112, 118
section CallTarget+Inlining+NGEN
This PR (8569) - mean (810ms) : 782, 838
master - mean (808ms) : 783, 834
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8569) - mean (104ms) : 97, 112
master - mean (103ms) : 98, 109
section Bailout
This PR (8569) - mean (104ms) : 98, 109
master - mean (104ms) : 99, 109
section CallTarget+Inlining+NGEN
This PR (8569) - mean (944ms) : 900, 987
master - mean (946ms) : 910, 981
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8569) - mean (100ms) : 96, 104
master - mean (100ms) : 96, 104
section Bailout
This PR (8569) - mean (104ms) : 98, 109
master - mean (104ms) : 99, 110
section CallTarget+Inlining+NGEN
This PR (8569) - mean (838ms) : 774, 901
master - mean (835ms) : 778, 892
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8569) - mean (196ms) : 193, 200
master - mean (195ms) : 191, 198
section Bailout
This PR (8569) - mean (200ms) : 193, 208
master - mean (199ms) : 196, 201
section CallTarget+Inlining+NGEN
This PR (8569) - mean (1,212ms) : 1165, 1259
master - mean (1,212ms) : 1173, 1251
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8569) - mean (282ms) : 274, 291
master - mean (277ms) : 269, 284
section Bailout
This PR (8569) - mean (281ms) : 277, 286
master - mean (278ms) : 274, 282
section CallTarget+Inlining+NGEN
This PR (8569) - mean (969ms) : 937, 1001
master - mean (964ms) : 938, 990
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8569) - mean (271ms) : 268, 274
master - mean (276ms) : 263, 290
section Bailout
This PR (8569) - mean (272ms) : 267, 277
master - mean (273ms) : 268, 278
section CallTarget+Inlining+NGEN
This PR (8569) - mean (1,153ms) : 1107, 1200
master - mean (1,144ms) : 1097, 1191
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8569) - mean (272ms) : 266, 277
master - mean (277ms) : 266, 287
section Bailout
This PR (8569) - mean (271ms) : 266, 275
master - mean (275ms) : 264, 287
section CallTarget+Inlining+NGEN
This PR (8569) - mean (1,033ms) : 986, 1080
master - mean (1,023ms) : 980, 1067
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Co-authored-by: Cursor <[email protected]>
Summary of changes
ProbeExpressionParsernow closes open generic scope member types during expression compilation, including constructed open generics such asIEnumerable<T>, by substituting safe reference-type generic parameters.Reason for change
IEnumerable<T>from generic methods/types. Passing those types to expression-tree construction can produce opaque failures.InvalidOperationExceptionmessages instead of actionable debugger evaluation errors.Implementation details
object, while value-type generic parameters are rejected because there is no safe substitute.Test coverage
DebuggerExpressionLanguageTestsfor open generic definitions, constructed open generics, null constructed-open generic arguments, value-type generic rejection, and friendly comparison errors.