简体   繁体   中英

Best way to automatically detect private variables in cached .net classes?

Using private variables in cached .net classes is a recipe for strange and often hard to debug problems.

See for instance: http://code-smart.org.uk/information/beware-asp-net-mvc-actionfilterattributes-are-cached-between-requests/

This can leed to session mixups/swapping! Usually these problems are blamed on not setting the output cache correctly.

Can (should?) Resharper detect these problems? Or is there another way?

It sounds like something nDepend might be able to do, it has a feature to be pretty much write linq to analyse code.

Here's some details about CLinq: https://www.ndepend.com/default-rules/webframe.html

It can be also used as part of your gated build pipeline: https://www.ndepend.com/docs/ndepend-console

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM