As the stacktrace in comment#3 of bug#614039 shows
there may be more than one thread accessing this field,
so we need locking around the code that modifies it and
the code that iterates it.
In regards to the Libraries property, as its public,
we make it do a copy of the list before returning it
to external consumers, but also locking while making
the copy. Also, to prevent external consumers from
modifying it (because they cannot hold the private
lock), we make its type be IEnumerable instead of IList.
This should prevent all data races around this field,
and fixes the last part of bug bgo#614039.