Morphir.Mep 0.5.0-alpha.4

Prefix Reserved
This is a prerelease version of Morphir.Mep.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Morphir.Mep --version 0.5.0-alpha.4
                    
NuGet\Install-Package Morphir.Mep -Version 0.5.0-alpha.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Morphir.Mep" Version="0.5.0-alpha.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Morphir.Mep" Version="0.5.0-alpha.4" />
                    
Directory.Packages.props
<PackageReference Include="Morphir.Mep" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Morphir.Mep --version 0.5.0-alpha.4
                    
#r "nuget: Morphir.Mep, 0.5.0-alpha.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Morphir.Mep@0.5.0-alpha.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Morphir.Mep&version=0.5.0-alpha.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Morphir.Mep&version=0.5.0-alpha.4&prerelease
                    
Install as a Cake Tool

Morphir.Mep

One implementation of the Morphir Extension Protocol (MEP) 0.2.0-draft.1 for morphir-dotnet hosts and guests: JSON-RPC 2.0 messages, Content-Length framing, the session lifecycle and the model transport. Work is tracked by #512 and add-mep-core. The roadmap is the Morphir extension model PRD, step 1.

Layers

Layer File What it does
Wire types Wire.fs Records and unions of the pinned contract, with parsed values (ProtocolVersion, SemanticVersion, Sha256Digest, RequestId). MepJson is generated from this file at build time by Morphir.Myriad.SystemTextJson. There is no reflection serializer.
Model transport ModelTransport.fs Tuple selection, the host check of a selection, envelope creation and admission. Pure functions.
Message codec Rpc.fs Classifies a JSON-RPC message by its members (JsonRpcMessage), keeps params raw, and writes messages. This is the only hand-written JSON.
Dispatcher Dispatcher.fs DispatchAsync(bytes, ct) returns the reply bytes, or none for a notification. A method table maps method names to typed handlers; a gate refuses a method before its handler runs.
Framing Framing.fs Content-Length frames on a Stream: header blocks up to 8192 bytes, bodies up to 64 MiB, checked before the body is read. A refused frame ends the connection.
Connection Connection.fs Reads frames, dispatches inbound requests concurrently, matches inbound responses to the pending-request table, and sends and receives $/cancelRequest.
Session Session.fs The pure lifecycle rules (Lifecycle.admit) and version negotiation, shared by hosts and guests.
Channel Channel.fs How a host session reaches its guest: a framed stream pair, or ISingleMessageChannel for a guest that takes one message per call. SessionFailure says why a single-message session ended.
Peers Peers.fs Guest (lifecycle methods, gate, extension methods) and HostSession (refuses to send what the guest must refuse).

On the guest side, the stream path (Connection) and the single-message path (Dispatcher.DispatchAsync) use the same dispatcher, so they give the same bytes. On the host side, HostSession holds a channel and applies the same lifecycle, version and model-transport rules on either. Starting a guest process is not in this project: a process host connects a HostSession to the child's streams.

Channels

A host session sends a request and waits for its reply, and sends notifications. It does both through a channel (CHAN-1). HostSession checks each request against the lifecycle state before it uses the channel, so a request refused on one channel is refused on the other with the same error, and the guest never receives it.

Channel Constructor What the guest is
Framed stream pair HostSession(input, output, host, offer) A process with Content-Length frames on its standard streams. Requests run concurrently and are matched by id; a cancelled request sends $/cancelRequest; the guest can send morphir.progress.
Single message HostSession(channel, host, offer) A guest that takes one whole message per call, such as the handle export of a WASM guest. The runtime implements ISingleMessageChannel; tests/Morphir.Mep.AotProbe has a C# implementation.

ISingleMessageChannel has two members. Both take the method name, the bytes of one complete UTF-8 JSON-RPC message with no Content-Length header, and a cancellation token. Both return the bytes of the message the guest returned, or null when it returned none.

  • RequestAsync calls the guest with a request.
  • NotifyAsync calls the guest with a notification, or withholds it when the guest's runtime does not deliver notifications to that guest. A withheld notification does not call the guest. HostSession always sends morphir.initialized and morphir.exit; the runtime decides whether the guest receives them.

The implementation passes bytes and does not check them. HostSession applies these rules to a single-message guest:

  • One call at a time. A request waits until no other call is inside the guest.
  • A request takes exactly one reply: the response or error response with the request's id. No bytes, a response for another id, a request or notification (such as morphir.progress), bytes that are not a JSON-RPC message, or a reply over ContentLengthFraming.MaxBodyBytes fail the session.
  • A notification takes no reply. Bytes returned for one fail the session.
  • The host never sends $/cancelRequest. When a request's token is cancelled, the channel stops the call and ends it with OperationCanceledException. The request ends with -32800 and the session ends.
  • An exception from the channel fails the session.
  • After the session fails, no message reaches the guest. Failure (C#: FailureOrNull()) says why, as a SessionFailure. The request that failed gets -32800 when it was cancelled and -32603 otherwise. Later requests get -32603 without a call. A failure during InitializeAsync gives InitializeFailure.Refused with that error. RunAsync ends with Stopped at exit or failure.

Which notifications a WASM guest accepts is read from its morphir.initialize result by the runtime, not by HostSession. The member that advertises it is not fixed in the contract yet (NTFY-1).

A guest and a host in memory

This example is compiled by tests/Morphir.Mep.Tests/ReadmeTests.fs. Keep the two equal.

let runSession (claims: CapabilityClaimSet) (capabilities: ExtensionCapabilities) =
    task {
        let guest =
            Guest(
                { Claims = claims
                  Capabilities = capabilities
                  Methods = readOnlyDict [] }
            )

        let toGuest = Pipe()
        let toHost = Pipe()
        let guestRun = guest.RunAsync(toGuest.Reader.AsStream(), toHost.Writer.AsStream(), CancellationToken.None)

        let host =
            HostSession(
                toHost.Reader.AsStream(),
                toGuest.Writer.AsStream(),
                { Kind = PeerKind.Cli; Name = "morphir"; Version = "0.4.0" },
                null
            )

        let hostRun = host.RunAsync CancellationToken.None
        let! session = host.InitializeAsync CancellationToken.None
        let! ping = host.PingAsync CancellationToken.None
        let! _ = host.ShutdownAsync CancellationToken.None
        do! host.ExitAsync()
        let! guestEnd = guestRun
        toHost.Writer.Complete()
        let! _ = hostRun
        return session, ping, guestEnd
    }

Add a method

  1. Check that the pinned contract has the method and its params and result types. Do not add a method, member or error code that the pin does not have; raise an upstream issue.
  2. Write a failing wire test, then add the types to Wire.fs with the attributes that the contract's wire rules need. Add the type to the contract test (ContractTests.fs): a complete sample, and the members that the contract text lets a reader default.
  3. Add the method to Method if it is new, and its capability to Lifecycle.capability if the contract makes it depend on one (the guest replies -32013 without it).
  4. Register a handler in the guest's Methods with Handlers.request (params bind as one object through their codec; absent or mismatched params give -32602), and add a typed call to HostSession if hosts send it.
  5. Add the method to the AOT probe (tests/Morphir.Mep.AotProbe) when it changes what C# calls.

The pin

tests/Fixtures/Mep pins the upstream contract model (mep.ir.json), the transcripts and the model-transport corpus by commit and digest. Do not edit the fixtures. To update the pin:

  1. Copy the new files from finos/morphir at one commit, and record the commit and the SHA-256 digests in PROVENANCE.md.
  2. Run the tests. ContractTests fails for each renamed or added member, and the transcript and corpus tests fail for each changed behavior.
  3. Change the types and rules in the same pull request. A new MEP version moves every MEP part in morphir-dotnet together; drafts match only exactly.

Where a transcript and the contract text disagree, the tests follow the contract text. The legacy transcripts initialize with 0.1; the replays use 0.2.0-draft.1 instead.

C# callers

The project is trimmable and AOT-compatible, with F# nullness metadata. Parsed values have TryParse and Create; FrameRead and SessionFailure have Match. tests/Morphir.Mep.AotProbe is a C# consumer that runs the full session on streams and on a C# ISingleMessageChannel; InteropTests and ChannelTests compile C# examples and check the nullable-flow diagnostics.

Tests

dotnet run --project tests/Morphir.Mep.Tests -- --summary
./build.sh --target TestAot --configuration Release

The first command runs the wire, contract, JSON-RPC, connection, session, channel and model-transport tests in memory. The channel tests use a fake single-message guest built on Dispatcher.DispatchAsync. The second is the Native AOT lane of the black-box tests: it publishes the probe (and the other probes and library hosts) with Native AOT, refuses IL diagnostics other than the FSharp.Core summary baseline, and compares the native output with the managed output. Both run in PR CI.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Morphir.Mep:

Package Downloads
Morphir.Extensions

Morphir extension registry domain: parsed extension identities, capability claims and the extension catalog

Morphir.Compilation.Mep

The MEP 0.2.0-draft.1 host side of guest processes: the guest process and session, and the frontend adapter, an IFrontend over a guest that serves morphir.frontend.compileModel. Trim-safe and AOT-safe.

Morphir.Extensions.Installation

Local extension package installation, inventory, selection and activation for Morphir tooling.

Morphir.Extensions.Wasm

The WASM extension runtime of morphir-dotnet: Wasmtime with the embedded Extism kernel module.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0-alpha.5 99 11/22/2026
0.5.0-alpha.4 96 11/16/2026
0.5.0-alpha.3 101 11/14/2026
0.5.0-alpha.2 100 11/13/2026
0.5.0-alpha.1 96 11/13/2026
0.4.0-alpha.5 100 11/13/2026
0.4.0-alpha.4 88 11/10/2026
0.4.0-alpha.3 86 11/9/2026

### Added

- The C# frontend of `morphir compile`: `morphir-dotnet.csharp` reads C# 15 source files in process, with Roslyn, in every offering. It lowers the C# dialect of the model (static classes and namespaces as modules, records and closed records as types, switch expressions as matches) to the current IR, and refuses code outside the subset with located diagnostics (`csharp.unsupported_*`).
- Passes: `transform` extensions that change a model between a frontend and a backend. `morphir extension list` shows them with their stage; `morphir generate` and `morphir compile` run them and report the applications under `passes` with `--json`. The first built-in pass, `morphir-dotnet.csharp.admission`, runs the checks of the C# backend before it. See [the middle end](docs/content/docs/pipeline/middle-end.md).
- `morphir generate` upgrades a classic model to the current IR when the backend reads the current IR only. The C# backend reads the current IR only, so `--target csharp` upgrades a classic model and runs the admission pass on it. `morphir extension list` shows the IR versions `4` and `4.0.0` for `morphir.csharp`.
- The C# backend writes local recursion: a tail call becomes a `while` loop, and any other recursive binding a local function. `List.filter`, `List.filterMap` and `List.foldl` map to `Morphir.SDK.CSharp`.
- `Morphir.SDK.CSharp` accepts plain C# records and plain C# unions in `Basics.Equal`, hashing and its collections. Equality and hashing use no reflection, so they work under Native AOT: a value outside the SDK kinds uses its own `Equals` and `GetHashCode`, and a delegate in code that people write compares by reference, as in .NET.
- `Morphir.SDK.CSharp` has generic `Basics` overloads for `T : INumber<T>` (`Add`, `Subtract`, `Multiply`, `Negate`, `Abs`, `Clamp`, `Power`) with checked arithmetic, and `List<T>` implements `IComparable<List<T>>` with the Morphir order.
- The C# backend writes generic functions over `comparable` (`where T : IComparable<T>`) and `number` (`where T : INumber<T>`), and checks the type at each call. The class of a type variable comes from the IR carrier, the `extensions` of its type attributes (`{"morphir-dotnet": {"classes": [...]}}`), else from the first word of its name. See [C# generation](docs/content/docs/backends/csharp/_index.md#generic-functions).
- The C# frontend writes the class of a type parameter in that carrier, from its .NET constraints (`IEquatable<T>`, `IEqualityOperators<T, T, bool>`, `IComparable<T>`, `IComparisonOperators<T, T, bool>`, `INumber<T>`) or from its uses in the body. On values of a type parameter, `a.Equals(b)` and `EqualityComparer<T>.Default.Equals(a, b)` become `Basics.equal`, and `a.CompareTo(b)` and `Comparer<T>.Default.Compare(a, b)` become `Basics.compare` matched to `-1`, `0` and `1`, with the ordinal order of the SDK.
- The C# frontend reads C# 15 unions. `union Shape(Circle, Rect)` is a custom type with the constructors `Circle` and `Rect`, each with the case type as its one argument `value`. A conversion to the union, `new Shape(circle)` and a cast apply the constructor; `Circle c`, `Circle(var r)` and `Rect { W: var w }` on a union are constructor patterns; `s is Circle` is a match that gives a `Bool`; `a.Equals(b)` on two unions is `Basics.equal`. A union that cannot convert is refused: a case with no name (`csharp.unsupported_union_case`), a member (`csharp.unsupported_union_member`), a case that another union of the module also has (`csharp.name_collision`), and code that reaches the state with no case: `default` (`csharp.unsupported_union_default`), a `null` arm (`csharp.unsupported_union_null`), `Value` (`csharp.unsupported_union_value`) and `IUnion` (`csharp.unsupported_union_interface`).
- The C# analyzer rule `MORPHIR1009` (`csharp.unsupported_abstract_record`) reports an older encoding of a sum type: an `abstract record` that is not `closed`, such as one with a private constructor and nested `sealed record` cases. `morphir compile` refuses it with the same code, message and range. A `closed record` and a union are not reported.
- `Morphir.Lang.CSharp.CodeFixes`: a Roslyn code fix for `MORPHIR1009` that changes an older sum type encoding to a `closed record` with the same cases and fields ("Change to a closed record"). It uses the Workspaces layer of Roslyn, so only an IDE loads it: no host, `Morphir.Lang.CSharp` or `Morphir.Tooling` references it, and a build test checks the restored closure of each host. The fix never changes a union. The page of the C# frontend documents the two sum type forms, the older encoding and the fix, and tests compile its examples.
- C# handling options in code: `[MorphirEquality(FloatEquality.Ieee)]` (assembly, type, property or positional parameter), `[MorphirEmit(Traversal = ..., TailRecursion = ...)]` and `[MorphirLoop(...)]` (assembly, class or method), and `[MorphirValueClass(...)]` on a type parameter, in the attribute assembly of `Morphir.Lang.CSharp`. A project needs no `morphir.toml` for them. The nearest attribute wins, and the command line wins over each attribute. The C# frontend writes a backend option into the model, in the `extensions` of type attributes under `morphir-dotnet.options`, so `morphir generate` on the model file applies it and writes the attribute back. A field with plain equality in a type with IEEE equality compares as plain C# does.
- The `[codegen.csharp]` table of `morphir.toml` has the keys of the C# backend: `extension`, `namespace`, `language_version`, `profile`, `traversal`, `tail_recursion` and `float_equality`. `morphir generate` and `morphir compile --target` give each key except `extension` to the backend, below the attributes of the model, and `--option` wins over each key. The C# backend accepts `--option traversal=loopfunctional`, `tail-recursion=looplocal-function` and `float-equality=clrieee`. A malformed value fails with exit code 2 before any file is written.
- `[frontend.csharp]` in `morphir.toml` has the key `loop_lowering` (`traversal`, `recursion`), the configuration carrier of `[MorphirLoop]`. An attribute on the method, the type or the assembly wins over the key. The table is closed, so a key that the C# frontend does not know, or a bad value, fails when the configuration loads, with exit code 2. `morphir compile` gives the scalar keys of the `[frontend.<language>]` table of the selected frontend (except `extension` and `project_file`, with `-` for `_`) to the frontend as extra members of the MEP `CompileOptions`; `CompileRequest.ExtraOptions` carries them, and the MEP frontend adapter writes them to a guest. See [C# handling options](docs/content/docs/backends/csharp/options.md#frontend-options-in-morphirtoml).
- The C# admission rule `MORPHIR1010` (`csharp.unsupported_non_partial_equality`) refuses a record or a union with IEEE equality from an attribute that is not `partial`.
- Packages `Morphir.Lang.CSharp` and `Morphir.MiddleEnd`. `Morphir.Lang.CSharp` has the C# frontend, the C# passes and the C# backend, with its analyzer and attribute assemblies in `lib/`. `Morphir.MiddleEnd` has the IR upgrade steps, the semantic node addresses and the transform contract. `Morphir.Tooling` depends on both. The package also has the build integration: see the entries of the source generator and the MSBuild target.
- `CSharpPipeline.Generate` in `Morphir.Lang.CSharp`: the pipeline function of C# generation. It reads the bytes of a model, upgrades a classic model, runs the C# passes and the backend, and has no file or process access. It gives the paths and bytes of `morphir generate --target csharp`, and diagnostics with no files for a model that is not valid. `Morphir.Lang.CSharp` also targets `netstandard2.0` for it.
- The Roslyn source generator `Morphir.Lang.CSharp.Generator` (`netstandard2.0`): it runs the pipeline function on each `*.morphir.json` additional file of a project and adds the C# to the compilation. A model that is not valid gives the error `MORPHIR2001` with the model file and the reason; two models that write one file with different text give `MORPHIR2003`. `MorphirCSharpNamespace` sets the namespace. It compiles against Roslyn 5.12.0, the compiler of .NET SDK 11.0.100.
- The build integration of the package `Morphir.Lang.CSharp`: `analyzers/dotnet/cs` has the source generator and the admission analyzers with their closure, and `build/` has the props and targets. A project with `<MorphirGenerateCSharpFiles>true</MorphirGenerateCSharpFiles>` gets the opt-in MSBuild target: it writes the generated files into `$(IntermediateOutputPath)morphir/csharp/` before the compilation and compiles them, and the source generator does nothing. The package sets `LangVersion` 15, and a build with a .NET SDK older than 11.0.100 stops with the error `MORPHIR2010`, which names the SDK that it needs. The project can still target a lower framework.
- The source generator and the MSBuild target write the polyfill file `Morphir.Polyfill.g.cs` only for a target framework below `net11.0`. A library and an application that each have their own polyfill file build with no warning, and a `switch` in the application on a `union` or a `closed record` of the library is exhaustive.
- `scripts/csharp-sdk-matrix.sh`, a check in the `test` job of the Development workflow: a consumer of the packed `Morphir.Lang.CSharp` generates with .NET SDK 11.0.100, and SDK 10.0.100 and 10.0.403 stop with `MORPHIR2010`. The generator compiles against Roslyn 5.12.0, so it does not load in the compiler of SDK 10 (`CS9057`).
- The page [C# generation in a build](docs/content/docs/backends/csharp/build-integration.md): the source generator, the MSBuild target, their settings and diagnostics, the package layout and the support matrix. Visual Studio, Rider and VS Code are not tested. A packages-lane scenario runs the commands of the page as written.
- The C# frontend lowers loops (LOP-1). A `foreach` that adds to an empty `List<T>` becomes `List.map`, `List.filter` or `List.filterMap`; a `foreach` that changes locals becomes `List.foldl`, with a tuple state for two or more locals; a `while`, `do` or `for` loop, and a `foreach` with `break`, `return` or `continue`, becomes a `LetRecursion` whose parameters are the changed locals. One loop recognizer in `Morphir.Lang.CSharp.Analyzers` decides for the analyzer and the frontend, so the IDE and `morphir compile` accept and refuse the same loops.
- `Morphir.SDK.CSharp` `List<T>` has `Select`, `Where` and `Aggregate`, the functional forms of `List.map`, `List.filter` and `List.foldl`, beside `FilterMap`. They come before the methods of LINQ, so each call on an SDK list gives an SDK value.
- The C# frontend reads the functional forms as the IR of the loop forms: `Select` is `List.map`, `Where` is `List.filter`, `Aggregate` is `List.foldl` and `FilterMap` is `List.filterMap`, on LINQ and on an SDK list. `Where` then `Select` is `List.map` over `List.filter`. A lambda that only applies a function to its parameter is that function: `o => Notional(o)` is `notional`. Local functions next to each other are one `LetRecursion`. `Maybe<T>.Just` and `Maybe<T>.Nothing` are the constructors of `Maybe`.
- The C# backend has two profiles for the rows of the transform table, with the handling option `profile` (`--option profile=imperative`, the default, or `--option profile=functional`, or the key `profile` of `[codegen.csharp]`). The imperative profile writes a `foreach` that adds to a list for `List.map`, `List.filter` and `List.filterMap`, and a `foreach` with accumulator locals for `List.foldl`. The functional profile writes `Select`, `Where`, `FilterMap` and `Aggregate`. A tail-recursive `LetRecursion` that the code after it calls once is a `while` loop with state locals in each profile. The frontend reads the C# of each profile back to the same IR. See [C# generation](docs/content/docs/backends/csharp/_index.md#profiles).
- The loop options apply to loops: `[MorphirLoop(LoopLowering.Recursion)]` makes a fold a `LetRecursion` over the list, and `--option tail-recursion=local-function` (or `[MorphirEmit(TailRecursion = TailRecursionForm.LocalFunction)]`) writes a tail call as a call of a local recursive function. `--option traversal` selects the loop form or the functional form of one profile rule.

### Changed

- **BREAKING:** the C# backend is written on Roslyn and writes C# 15 only. `language-version=14` now fails with `unsupported-language`, and `language-version=15` is the default.
- **BREAKING:** the package `Morphir.CodeGeneration.CSharp` is removed. The package `Morphir.Lang.CSharp` replaces it: the API of the backend is `CSharpBackend.Generate` in `Morphir.Lang.CSharp.Emit`.
- **BREAKING:** the shape of the generated C# changed. A module with only types is a namespace, and a module with values is a `static class` named after the module (no `...Module` suffix), with its types nested in it. A custom type is a `closed record` with `sealed record` cases, or a `union` of wrapper cases (no `abstract class` with nested cases). Records have the equality of plain C#: `NaN` is equal to `NaN`. The Morphir members (`MorphirEquals` and the others) are written only when you ask for IEEE equality. A file `Morphir.Polyfill.g.cs` carries the runtime types that `closed` and `union` need below .NET 11. See [C# generation](docs/content/docs/backends/csharp/_index.md).
- The Native AOT `morphir` links Roslyn for the C# frontend and backend.
- The C# backend refuses equality on a type that holds a function at generation time with `unsupported-equality`, also through a type variable, a field of a case or the record of a union case, and the message gives the path to the function type. A generic function over `appendable` or `compappend` is refused with `unsupported-appendable`.
- `MORPHIR1001` (`csharp.unsupported_loop`) refuses only a loop with no Morphir form, and its message gives the reason: the loop writes a field, a property or an array element, reads a field that can change, changes no local and builds no list, or builds a list in a form that has no list function. A change of a local in a loop is the state of the loop, so `MORPHIR1002` does not report it.
- The C# admission rules (`MORPHIR1001` and the others) cannot be suppressed: `#pragma warning disable`, `.editorconfig` and `NoWarn` do not hide them, and the new rule `MORPHIR1008` (`csharp.unsupported_suppression`) refuses a `SuppressMessage` attribute that names a rule. A refused construct cannot become a model, so `morphir compile` refuses it in every case.

### Fixed

- The C# frontend gives the model that the C# means, or it refuses the C#. Named arguments bind to their parameters; a record value gets each field by name, and an object initializer sets a field again; a switch on an enum gives constructor patterns; the variable of a case field does not capture a parameter; a generic call has the types of the call. `switch` statements whose sections return and tuple deconstruction declarations are lowered. A record value that leaves out a field, an abstract record, record inheritance, a record member that is not a field and a static member that is not a method or a constant are refused. Two constructors of one module with one Morphir name give `csharp.name_collision`. The compilation has the implicit usings of an SDK project.
- The C# analyzer refuses a symbol from an assembly outside the fixed reference set, including NuGet packages with a `System` name, and no longer reports a deconstruction declaration as a mutation. `morphir compile` reports an analyzer failure (`AD0001`) as an error, gives a missing return a location in the document, and puts diagnostics in the same order on each run.
- The C# backend writes only the switch arms that can match, so a match on `True` and `False`, a repeated arm and a covered arm compile. A negative literal given to a wrapper case compiles. Two record aliases that share one C# record keep their field values. Functions of one `LetRecursion` that call each other only as their last step become one `while` loop with a state, so deep mutual recursion does not overflow the stack. The layout re-parse uses C# 15.
- The C# backend writes `Morphir.Polyfill.g.cs` into each output, with `IsExternalInit` (below .NET 5), `CompilerFeatureRequiredAttribute` (below .NET 7) and `UnionAttribute`, `IUnion` and `IsClosedTypeAttribute` (below .NET 11).
- The C# backend refuses with `name-collision`, and names both owners, when a case, a type, a value or a module class has the name of another in one namespace or static class. A value or a type with a name that ends in `Module` now generates. A wrapper custom type with private constructors, or with two constructors of the same C# type, is a `closed record` with sealed cases, not a `union`. A public module below a module with no module of its own between them is reachable.
- The C# backend generates a module that has a record alias and a wrapper case of the same name, such as the record `Circle` and the case `Circle Circle` of the union `Shape`. Before, a construction or a match of the case failed with `ambiguous-constructor`. A wrapper type (`union`) and a mixed type (`closed record`) come back from the generated C# through the C# frontend with the same IR.
- `generate --target csharp` stops before the backend with `transform.feature_remains` when an extensible record, a hole or a body that is not an expression remains after the passes. `compile --target` reports the passes before the backend in `generation.passes`, with their diagnostics, and one application list from the frontend output. An IR upgrade error names the address of the node that the current IR cannot hold. The application list names a node of the input for a rule that rewrites inside an earlier replacement, an upgrade chain pins each kept record to its output, and the passes report keeps the upgrade records when no pass ran.
- The C# frontend reads the C# that the C# backend writes: a call of `Morphir.SDK.CSharp.Decimal`, such as `Decimal.Mul(a, b)`, is the SDK function of the module `Decimal`, and `List<T>.FromEnumerable(new T[] { ... })` is a list value. Before, the frontend refused both with `csharp.unsupported_reference`, so a model with a decimal operation or a list did not come back from its generated C#.