public static class BridgeGeneratedCode Checks that generated Bridge code matches the generated-code support API of this runtime (RUNICBRIDGE038).
Remarks
The generated AddRunicBridges() calls BridgeGeneratedCode.RequireContract before it registers any Bridge, with the contract version its generator wrote. The version changes only when the support API breaks binary compatibility, so a library that an earlier minor release of the same major generated keeps loading. A library whose Bridges another major release generated fails there with RunicBridgeContractException, before a Bridge type is loaded. The method keeps this signature in every release, so the call itself never fails to bind.
Bridges from before 0.19 make no such call. Host adapters wrap their root Bridge factory with BridgeGeneratedCode.StaleBridge, which turns the TypeLoadException or MissingMemberException of such a Bridge into the same exception when the first Window or View attaches it.
Methods
RequireContract
public static void RequireContract(int contractVersion, Assembly generatedAssembly) Throws RunicBridgeContractException when contractVersion is not a generated-code contract this runtime runs. The generated AddRunicBridges() calls it first.
Parameters
contractVersionThe contract version the generator wrote.
generatedAssemblyThe assembly that contains the generated Bridges.
StaleBridge
public static RunicBridgeContractException? StaleBridge(Exception error, Delegate factory, Type viewModel) Returns a RunicBridgeContractException for error when a generated Bridge factory failed because its Bridge was generated against another Runic release, otherwise null.
Parameters
errorThe exception the factory threw.
factoryThe generated Bridge factory, which names the assembly to rebuild.
viewModelThe ViewModel type the factory attaches.
Remarks
Use it as an exception filter around the factory call: catch (Exception e) when (BridgeGeneratedCode.StaleBridge(e, factory, typeof(T)) is { } stale) { throw stale; }.