private readonly Dictionary<int, ManualResetEvent> _ack_events = new Dictionary<int, ManualResetEvent>();
private void ACKRecieved(int ackType)
{
if (!_ack_events.ContainsKey(ackType))
{
_ack_events.Add(ackType, new ManualResetEvent(true));
}
_ack_events[ackType].Set();
}
OK so here's the issue. Visual Studio throws an exception at the statement:
ack_events.Add(ackType, new ManualResetEvent(true));
How?
The type of ackType
is an int
so it can't be null and I don't see how new ManualResetEvent(true)
could ever possibly evaluate to null
either so... What gives? _ack_events
is obviously not null
either, as it gets initialized during construction.
All I can ask is... wha?