Commit a23d045
Fix circular init in AOT equality comparer causing NRE on Mono (#73)
The defaultComparer field in AssertEqualityComparer (AOT path) eagerly
creates AssertEqualityComparerAdapter<object>, which triggers
AssertEqualityComparer<object>'s static initializer. That initializer
reads defaultComparer back via GetDefaultInnerComparer before the field
has been assigned. On Mono/WASM this results in DefaultInnerComparer
being permanently null, leading to NullReferenceException when comparing
value types via IStructuralEquatable.
Fix by creating a new instance on each call, matching the non-AOT
reflection path behavior.
Port of dotnet/arcade#16615
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 6ce8f86 commit a23d045
1 file changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | | - | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | | - | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| |||
0 commit comments