C# 13 will warn when upcasting System.Threading.Lock to object in order to prevent accidentally using lock(object) rather than lock(Lock), and therefore calling Monitor.Enter/Monitor.Exit over the Lock object.
https://github.com/dotnet/csharplang/blob/d0c84ab39867f28914180ce31099d5aefc3c8280/proposals/csharp-13.0/lock-object.md?plain=1#L72-L90
https://github.com/dotnet/csharplang/blob/main/meetings/2023/LDM-2023-12-04.md?plain=1#L35-L44
We should consider doing the same if other lock types are upcasted, such as SemaphoreSlim.