Skip to content

Skip visibility checks for dynamically generated methods without DynamicMethod #48024

Discussion options

You must be logged in to vote

You can bypass access checks using IgnoresAccessChecksToAttribute. The runtime understands the attribute, but it is not defined in the BCL so you have to define it yourself.

Here's a modified version of your fiddle which includes the attribute: https://dotnetfiddle.net/YPkT7H


As an aside, if that fiddle is the main motivation for you doing this you should look at CollectionsMarshal.AsSpan.

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@PathogenDavid
Comment options

@TwentyFourMinutes
Comment options

@PathogenDavid
Comment options

@TahirAhmadov
Comment options

@PathogenDavid
Comment options

Answer selected by TwentyFourMinutes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants