You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4f30509
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: src/Stunts.UnitTests/Castle/Unsupported.md
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ The tests next to this file are the Castle scenarios the generator can carry. Th
31
31
| Covariant returns |`LanguageFeaturesTests`|
32
32
| Records (positional, empty, record plus an extra interface; `with` keeps the stunt type) |`LanguageFeaturesTests`|
33
33
|`ref readonly`, `Span<T>` and other `ref struct` arguments and returns, pointer parameters |`Scenarios/SignatureRefs`|
34
+
| Custom attributes on generated types, members, parameters, and returns; optional parameter defaults (including reflection invocation) |`AttributeTests`|
34
35
35
36
Behaviors added with `AddBehavior` after `Stunt.Of` do not see virtual calls made from a base constructor. Castle passes interceptors into proxy creation, so they do. `BehaviorPipelineFactory` is the matching extension point, and `ClassProxyTests` uses it.
36
37
@@ -46,24 +47,28 @@ Castle's `IProxyGenerationHook` omits members from the proxy type. Stunts overri
46
47
47
48
### Metadata Castle copies onto the proxy
48
49
49
-
The scaffold copies signatures, names, and generic constraints. It does not copy:
50
+
The generator copies C#-expressible metadata, including custom attributes and optional
51
+
parameter default values (covered by `AttributeTests`). Remaining metadata gaps are:
50
52
51
-
- custom attributes on methods, properties, parameters, or the type (`[Serializable]`, `[Guid]`, parameter attributes)
52
-
- metadata-only custom modifiers (`modopt` / `modreq`) that have no C# spelling. `in`, `ref readonly`, and function-pointer calling conventions are emitted as those keywords, and the compiler writes the matching modifier
53
-
- optional-parameter default values (callers compiled against the original type still get the compiler default; reflection on the proxy method does not)
53
+
- metadata-only custom modifiers (`modopt` / `modreq`) with no C# spelling
54
54
- extra attributes supplied at generation time (`ProxyGenerationOptions.AdditionalAttributes`)
55
55
56
56
### Serialization
57
57
58
-
Castle's proxy serialization (BinaryFormatter, `ISerializable`, restoring interceptors, mixins, selector, and generation options, including graphs with delegates back to the proxy) is a generator feature. Compile-time stunts are ordinary classes with none of that infrastructure. XML serialization of a proxy is the same kind of gap: the generated type does not replicate the attributes and constructor shape `XmlSerializer` expects.
selector, and generation options, including graphs with delegates back to the proxy) is
60
+
not implemented by compile-time stunts. Copying `[Serializable]` and other attributes
61
+
does not provide that proxy-serialization infrastructure.
59
62
60
63
### Delegates as additional type arguments
61
64
62
65
`Stunt.Of<SomeDelegate>()` returns a delegate bound to a generated `Invoke`, and `Stunt.Of<SomeDelegate>(implementation)` forwards `next` to that delegate. A delegate combined with a class or another interface is `ST010`. Castle can also mix a delegate `Invoke` onto some other proxy (`AsDelegate` is the missing cast).
63
66
64
-
### Same signature on two interfaces
67
+
### Cannot distinguish identical interface slots
65
68
66
-
One public method implements both. Both calls are intercepted, and a behavior cannot tell which interface was used. Castle emits explicit implementations so `IInvocation.Method` differs.
69
+
Identical signatures from two interfaces share one generated implementation. Both calls
70
+
are intercepted, but a behavior cannot tell which interface slot was called. Castle can
71
+
emit explicit implementations so `IInvocation.Method` differs.
0 commit comments