Comment on That Shouldn't Happen – UnreachableException in .NET 7parentComments−piaste3yThey could easily have declared TeamId as non-nullable in modern C# too.The issue they had is:(a) TeamId is legitimately nullable at creation, there are valid SlackEvents without a TeamId(b) They wanted to assert "TeamId won't be null" from a certain point in the code path(c) They didn't want to create a different data structure (TeamSlackEvent or something) to hold the definitely-has-a-TeamId events.I strongly suspect (c) was a mistake and they were just too lazy to define a new (sub)-class or record.
Comments
They could easily have declared TeamId as non-nullable in modern C# too.
The issue they had is:
(a) TeamId is legitimately nullable at creation, there are valid SlackEvents without a TeamId
(b) They wanted to assert "TeamId won't be null" from a certain point in the code path
(c) They didn't want to create a different data structure (TeamSlackEvent or something) to hold the definitely-has-a-TeamId events.
I strongly suspect (c) was a mistake and they were just too lazy to define a new (sub)-class or record.