The error here is changing the lock object .
In Pulse [All] you must have a lock. It looks like you have a lock, but if you look closely, rewrite yyy
in code, so this is a different object.
For this reason, lock objects are usually readonly
fields.
Also, blocking by type or boxed type is generally a bad idea; the most suitable locking object is:
private readonly object syncLock = new object();
(may be static
if necessary)
As a private instance, you avoid unexpected lock conflicts; beig readonly avoids accidental reassignment.
source share