Commit 2cf79ee
committed
Add failing test for proxying derived
On .NET 6+ this fails with a `TypeLoadException`:
> Return type in method `DerivedEmptyRecord.<Clone>$()` [...] is not
> compatible with base type method `EmptyRecord.<Clone>$()`
From dotnet/efcore#26602 (comment):
> The C# compiler changed the emit strategy for records in .NET 6 to
> take advantage of covariant returns. The Clone method now always has a
> return type that matches the containing type. Covariant returns were
> added to the runtime and language in .NET 5 but records didn't take
> advantage of them (just ran out of time). In .NET 6 though we finished
> off that feature and added it to records.
So we'll need to add support for covariant returns to DynamicProxy.record type1 parent 9a84a79 commit 2cf79ee
File tree
2 files changed
+26
-0
lines changed- src/Castle.Core.Tests/DynamicProxy.Tests
- Records
2 files changed
+26
-0
lines changedLines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
0 commit comments