Mono(ccrewrite)

πŸ’– ccrewΜΆiΜΆtΜΆeΜΆ ccrewrite β€” the manual page, bestie edition πŸ’–

okay so this is ccrewrite, from the Mono manual (section ccrewrite, iykyk) and she is literally the girl who rewrites your CLR assemblies so your code contracts actually get checked at runtime. no cap. πŸ’…


✨ NAME ✨

ccrewrite β€” rewrite CLR assemblies for runtime code contract verification. periodt.


✨ SYNOPSIS ✨

ccrewrite --assembly=<assembly> [options]

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically? ccrewrite rewrites CLR assemblies and converts calls into the System.Diagnostics.Contracts namespace so they do runtime contract verification for real. and yes, that includes contract inheritance for virtual methods. she's giving thorough. πŸŽ€

⚠️ the assembly must have been built with the symbol CONTRACTS_FULL defined, otherwise the compiler already yeeted all your calls to the contract methods. gone. deleted. not coming back. 😭

rn only pre-conditions are supported, using the Contract.Requires() method. contract inheritance for virtual methods is supported though, slay. also heads up: only a limited range of operations and types can be used inside a pre-condition, and if ccrewrite can't process the assembly you gave her, she will show you an error message. she's not being mean, she's being honest. πŸ’€


🌸 CONFIGURATION OPTIONS 🌸

  • --assembly <assembly-name> β€” the assembly to rewrite. if you don't pass --output, this file gets overwritten with the rewritten version. lowkey destructive, highkey intentional. 🫢
  • --debug β€” use debug information if it's available, so your contract failure messages are actually useful instead of cryptic. main character debugging energy. πŸ”₯
  • --help β€” show help for ccrewrite, listing all the configuration options. bestie behavior fr fr.
  • --level <level> (default=4) β€” sets which contract types are present in the rewritten assembly:
    • 0 = No contracts
    • 1 = Release requires
    • 2 = Requires
    • 3 = Ensures
    • 4 = Invariants

and note: each level includes all previous levels. it's cumulative, she's generous like that. πŸ‘‘

  • --output <file-name> β€” write the rewritten assembly to the specified file. if this isn't present, then the input assembly file is overwritten with the rewritten version. again. be careful. πŸ™ˆ
  • --rewrite (default=true) β€” rewrite the assembly. if false, then literally nothing is done. she's off the clock. πŸ’…
  • --throwOnFailure (default=false) β€” throw a ContractException on unhandled contract failure. the default behaviour is to Assert. pick your fighter. ⭐

🧚 AUTHOR 🧚

Written by Chris Bacon. icon.


Copyright (C) 2010 Chris Bacon. Released under MIT license. we love a permissive license moment. 🌈


πŸŽ€ WEB SITE πŸŽ€

Visit http://www.mono-project.com for details. go, go, go. πŸ¦‹


okay that's the whole thing bestie, no notes, ate and left no crumbs πŸ’– and as for the boring official bits: this page lives in the Mono(ccrewrite) manual, that's the source/version tag it signs off with, and that's the footer name right there at the bottom too β€” so consider it mentioned, cute sign-off complete, mwah πŸ’…βœ¨