c# - Should I GetReadLock() while iterating through RouteCollection? -


i have misunderstandings use of routetable.routes.getreadlock() while overriding getvirtualpath method in custom route class.

according msdn docs

there 2 scenarios in not have call getreadlock: public methods of routecollection class such getvirtualpath , getroutedata call getreadlock internally. therefore, not have explicitly call getreadlock when call public method of routecollection class retrieve data collection.

since i'm overriding getvirtualpath , getroutedata seems there won't internall calls, unless it.

in .net 3.5, following line works smoothly:

using (routetable.routes.getreadlock()) {     // iteration on routes } 

in .net 4.5, i'm receiving error:

recursive read lock acquisitions not allowed in mode.

so question is:

should bring force dark magic in order lock it, or microsoft has aleardy handled readlock() scenario in .net 4.5 ?

thank sharing experience!


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -