Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Take a look at the <a href="http://dotnetinside.com/framework/v4.0.30319/System/CookieContainer" rel="nofollow">CookieContainter</a> class and you'll see that concurrent scenarios are suppose to occur when there are changes in the cookie collection, right?</p> <p>You'll notice that the author of CookieContainer took care of using <code>lock {}</code> and <code>SyncRoot</code> all around these collection-changing parts of the code, and I don't think that such approach is not addressed to concurrent scenarios. </p> <p>Also, you can notice that any added <a href="http://dotnetinside.com/framework/v4.0.30319/System/Cookie" rel="nofollow">Cookie</a> is literally <strong>cloned</strong>, so the cookies inside the container and all the operations made will not mess up with object references outside the cookie container. In the worst case of I'm missing something, the clone also gives us a tip of what exactly you have to copy and how you could do it, in case of using the reflection approach described in the other posts (I personally would not consider it a hack, since it fits the requirement and it is managed, legal and safe code :) ).</p> <p>In fact, the mentions all over MSDN documentation are "Any instance members are <strong>not guaranteed to be</strong> thread safe." - its a kind of reminder, because you are right, you really need to be careful. Then with such statement you can suppose basically two things: 1) Non-static members are not safe at all. 2) Some members can be thread safe, but they aren't properly documented.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload