When does the .NET CLR evaluate security attributes?

I just read the following in the CLI spec regarding SecurityExceptions when calling a method:

A security check can occur when CIL is converted to native code, and not at run time.

How does the Microsoft implementation do it?

If, for example, only a certain group of users has access to a certain class, and I put a security attribute for this group.

If the user starts the application, it is a fraction, and perhaps security checks are performed at this time, and not at run time.

If so, does the jitter frame use its own image so that it can cause problems if I change the user group later (i.e. the cached native image does not reflect its updated permissions)? Or does it crush every time it starts, unless I set my own image? I'm still not quite sure how my own image cache works.

+5
source share
1 answer

Any fractional image is valid only in the same security context in which it is generated.

This applies to both building the cache and ngen: ed.

As soon as the loader sees that the current security context is different, it will load the IL image and JIT assembly.

- .

.Net. ngen: ed ( ngen) .

: msdn ngen.exe

+2

All Articles