Urgent.News

What's breaking now, across thousands of outlets.

Tech

Decompiling generic constraints and variance: reconstructing where-clauses and out/in from metadata

Most C# features a decompiler recovers are compiler sugar : the compiler lowered a foreach into a try / finally around an enumerator, or an iterator into a state machine, and the decompiler recognises the shape of the emitted code and folds it back. Generic constraints and variance are not like that. There is no code to recognise, because a constraint is not executable. where T : class,…

Generic constraints and variance in C# are not recognized by decompilers because they are represented as metadata rather than executable code. The decompiler cannot reconstruct the constraints and variance based solely on the emitted IL (Intermediate Language). The constraints and variance are stored in metadata tables, specifically the GenericParam table, which contains information about the type parameters, their positions, owners, and flags.

The VarianceMask in the Flags column stores the covariant (out) or contravariant (in) information for interface and delegate parameters. The SpecialConstraintMask in the Flags column stores the reference-type constraint (class), value-type constraint (struct), or default-constructor constraint (new()). These constraints are part of the type's public contract, as they determine what a caller can substitute for the type parameter and which assignments between constructed types are legal.

The decompiler must accurately reconstruct the constraints and variance based on the metadata to ensure the regenerated type complies with C# syntax and semantics.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The agent is a user without a license

The agent without an ID United Airlines will restrict third-party AI agents from its website, its app, and also when they arrive through agencies and aggregators (cnbc.com).

  • United Airlines restricts third-party AI agents on platforms
  • Amazon blocks AI agent, Meta's integrated with conditions
  • Walmart integrates AI agent despite security risks

Freelancer Retainers: Turn One-Off Projects Into Steady Monthly Income

Every freelancer knows the feast-and-famine cycle. One month three clients pay at once and the bank account looks generous.

  • Retainer agreements provide freelancers with steady monthly income.
  • Clients with prior work experience are ideal for converting into retainers.
  • Clearly outline hours, scope, unused hours, and termination notice in agreement.

10 PCB faults that pass DRC and still cause a respin

Your PCB passed DRC with zero errors. The Gerbers look clean in the viewer. So the board is ready for fab, right? Not quite. DRC checks the rules you gave the tool.

  • Ensure exact part number matches BOM and datasheet, including suffixes and version numbers
  • Meticulously map strap pins to intended function to avoid boot mode inconsistencies
  • Verify land patterns against datasheet specifications, accounting for vendor variations

More from Friday 13 November →