Skip to content

Conversation

@samblackburn
Copy link
Owner

@samblackburn samblackburn commented Oct 7, 2025

Our engine now has even more consumers, so here's support for:

Another generics case

When both the consuming method and the consumed class have the same constrained generic parameter, NetDoc was failing to find the type constraint and defaulting to object. This PR fixes that limitation.

Very basic delegate support

Delegate constructors are weird. The C# looks fairly straightforward:

public delegate bool MyDelegate(int i);
MyDelegate MakeDelegate() => i => i > 3;

However the IL uses a hidden constructor that takes an object (the instance, or null for static methods) and an IntPtr to the method you want to call on that object. This can't be directly called in C# because magic. Figuring out the parameters seems to be hard, so for now we'll just output a best guess of _ => default. This has several shortcomings:

  • It will break for void delegates (see ignored test)
  • It will break for numbers of params other than 1 (see ignored test)

@samblackburn samblackburn changed the title Support for Support a generics edge case and single-parameter delegates Oct 7, 2025
@samblackburn samblackburn merged commit 59fd077 into main Oct 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants