Comment

Comment by orphea

This attribute makes the compiler generate IL code as if the target member was accessible to the user code. It's orthogonal to AoT and reflection.

This works perfectly fine with AoT:

  var writeLine = typeof(Console).GetMethod("WriteLine", [typeof(string)]);
  writeLine.Invoke(null, ["Hello world"]);
As you can see, there are no UnsafeAccessorAttribute's. Plain old reflection that just works (why should it not?)

https://godbolt.org/z/Yv8hadYqv

parent orphea 3 months ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton