question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] Simplified ldftn/ldvirtftn

See original GitHub issue

Hi Lucas!

I would like to propose simplified way to use ldftn and ldvirtftn instructions:

public static void Ldftn<TMethod>(TMethod method) where TMethod : Delegate;
public static void Ldvirtftn<TMethod>(TMethod method) where TMethod : Delegate;

With these methods I can specify method directly without construction of MethodRef. In case of ldvirtftn it easily to analyze whether the specified method is virtual/abstract or not.

Alternative approach is to use factory method declared in MethodRef class:

public static MethodRef Create<TMethod>(TMethod method) where TMethod : Delegate;

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ltrzesniewskicommented, Jul 17, 2020

I got it mostly implemented in the methodref-delegate branch. I just need to make sure I didn’t forget anything, and maybe do some cleanup. I should release it soon.

I changed one thing though: referencing a compiler-generated method will generate an error instead of a warning. After seeing what the C# compiler generates for the various cases, I realized there’s really no good way to use such a method in a sane way.

1reaction
ltrzesniewskicommented, Jul 11, 2020

I suppose I can add a warning for these cases, mostly to prevent unintentional misuse.

You can suppress InlineIL warnings through the weaver config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Making proposals simple
A simple technique for improving proposal storytelling, messages, themes, and positioning · How to formulate win strategies in just 3 steps · Do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found