Profiling/Debugging Real Time Security Checks

M

Mark Leistner

I have a medium sized application (say 50k lines) that occasionally will
spike the % of time in RT security checks performance counter between 50 and
95%.

It can perform hundreds of thousands of code access security permission
checks in a few seconds in some cases.

I know that I can set a permission set on a higher level method and demand
then assert to help allieviate some of these checks, but how do I go about
determining what method to assert the permissions and which permissions to
assert?

I guess what I'd really like is to get a list of methods with the number of
calls and the number of code access security permission checks performed
(inclusive and exclusive).

Any ideas of how I can go about profiling/debugging this issue?
 
M

Mark Leistner

Well,

I think I figured out the majority of the problem. It's all LINQ's fault!! :)

It appears that at each run of a query LINQ is rebuilding the query and
causing quite a few security checks. I converted a single query from a
'normal' linq query to a compiled query and dropped the number of real time
security checks from 1.7m to 800k.

In normal cases I wouldn't hit anywhere near this due to caching, but there
are times...

Anyways thanks to anyone who took the time to look and maybe this will help
someone else out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top