Supported C#
Check which C# shapes Round Trip can represent and write, which are partial, and which remain source-owned in 0.89.0.
On this page
Roslyn can read a vast C# syntax tree. A useful graph needs a narrower promise: Round Trip must represent the behavior with meaningful nodes and pins, then write an edited shape without hiding or changing code it does not understand.
This matrix describes package 0.89.0. “Supported” means the parser and graph model have explicit shapes for the construct. “Partial” means tested forms are represented but other forms may remain source-owned. “Not yet” means Round Trip marks the construct instead of claiming graph ownership.
Support matrix
Section titled “Support matrix”| Construct | Status | Notes |
|---|---|---|
| Method entry, parameters, locals, declarations, assignment, compound assignment, and return | Supported | Includes ordinary imperative method bodies and multiple declarators when read. Some generated declaration shapes can still be refused when a safe statement cannot be emitted. |
| Calls and method groups | Supported | Instance and static calls, arguments, return values, and delegate method-group references have explicit nodes. |
Fields, properties, locals, this, and static reads or writes |
Supported | Reads appear as GET pills; writes use SET or assignment shapes. |
if, else if, and else |
Supported | Branch arms and their conditions are represented explicitly. |
for, foreach, while, and do while |
Supported | Includes break and continue; authored loops must still have the values needed to produce valid C#. |
switch statements and switch expressions |
Supported | Includes arms, goto case, and goto default. |
try, catch, filters, finally, bare rethrow, and throw |
Supported | Handler clauses and exception flow have explicit graph shapes. |
using scopes |
Partial | A synchronous using reads as one opaque scope node whose body is not expanded. Compile refuses to regenerate a body that contains one; edit that scope in C#. |
| Literals and operators | Supported | Includes unary and binary operators, comparisons, casts and conversions, plus inline scalar values and explicit conversion nodes. |
| Conditional and null-aware expressions | Supported | Includes ?: and null coalescing, along with null-conditional access and related expression nodes. |
| Arrays and indexed access | Supported | Includes indexers, from-end indexes, ranges and slices. Common construction and access shapes are represented. Array construction in unsupported positions can be refused during body generation. |
| Tuples and deconstruction | Supported | Tuple construction and element access have explicit nodes, as does ordinary deconstruction. Nested deconstruction remains limited. |
| Struct construction and common composite literals | Supported | Includes tested Unity value shapes such as vectors. |
| String interpolation | Supported | Holes become inputs while format and alignment information remain intact. |
nameof and common patterns |
Partial | Covered forms for object creation and type tests have graph nodes; unmodeled pattern shapes remain marked. |
| LINQ method chains | Partial | Modeled operators can appear as LINQ nodes. Query-expression syntax and unmodeled lambda shapes can become placeholders. |
| Async and await | Partial | Explicit nodes cover await, delay, WhenAll, WhenAny, await foreach, and await using in tested shapes. Other awaitable or nested callable shapes may remain source-owned. |
| Unsafe, fixed, pointers, and stack allocation | Partial | Explicit node kinds exist for tested unsafe scopes, pointer operations, casts, sizeof, and stack allocation. Support depends on the represented shape. |
| Local function declaration bodies | Not yet | The declaration can be marked in the outer graph, but its nested callable body is not graphed there. |
| Expression trees | Not yet | Their expression-building semantics are source-owned. |
dynamic runtime binding |
Not yet | Runtime member resolution has no safe graph contract. |
| Unknown statement or expression syntax | Not yet | It becomes a visible placeholder or diagnostic instead of being approximated. |
The safety rule
Section titled “The safety rule”Anything the parser cannot represent becomes a gray placeholder node. A method containing that placeholder refuses Compile until you fix the unsupported shape in C# and reload the graph.
That refusal is deliberate. Round Trip does not delete, guess, or rewrite an unknown statement to make the rest of the graph writable. Source remains the authority for that method.
A safe workflow
Section titled “A safe workflow”- Open the method and look for gray placeholder nodes or diagnostics.
- Select the placeholder and read the offending source range and reason when available.
- Right-click the placeholder, choose Go to Source, and rewrite only that construct into a supported shape.
- Return to Round Trip. The graph re-parses when the file is saved; use the reload icon if it has not.
- Confirm the placeholder is gone before making graph edits and pressing Compile.
If the construct should stay exactly as written, keep editing that method in C#. Round Trip can still help you inspect the represented parts, but it will not claim a safe write path for the whole body.