Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 630
Sander_P Avatar asked Nov 27 '17 17:11

Sander_P


1 Answers

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

like image 119
Alex KeySmith Avatar answered Oct 06 '22 18:10

Alex KeySmith