Open
Description
Description
The System.ComponentModel.Component will lock self when enter Dispose. Maybe there will be dead locks in this approach.
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
lock (this)
{
_site?.Container?.Remove(this);
if (_events != null)
{
((EventHandler?)_events[s_eventDisposed])?.Invoke(this, EventArgs.Empty);
}
}
}
}
Other information
The mini demo: https://github.com/lindexi/lindexi_gd/tree/5219a17e96a3577639d0b486c57bc699941c585b/HearwhejiyehallyiheFubaduwheefu
var component = new Component();
lock (component)
{
Task.Run(() => component.Dispose()).Wait(); // dead lock
}
Run the code, and then you will find that the thread never exits