Closed Lapiniot closed 3 days ago
Update: After brief investigation it appeared this issue is not connected to macOS Sequoia itself. This code is guilty:
// Query MulticastInterface option from the configured socket directly to get effectively applied value
var mcint = (int)socket.GetSocketOption(socket.AddressFamily is AddressFamily.InterNetwork ? SocketOptionLevel.IP : SocketOptionLevel.IPv6, SocketOptionName.MulticastInterface);
LogMulticastConfiguration(logger, groupEndPoint, new IPAddress(mcint));
Dev machine IP address somehow weirdly changed and this helped to discover serious issue. GetSocketOption returns boxed object representing System.Int32 value for SocketOptionName.MulticastInterface which must be reinterpreted as unsigned System.UInt32 before up-casting to wider signed System.Int64 as argument for IPAddress constructor, otherwise we may get negative value in the range of Int32 for some IP addresses (what actually happened :worried: ).
[!IMPORTANT] We should also interpret mcint differently depending on socket.AddressFamily: AddressFamily.InterNetwork - this value contains IPv4 address bytes and could be used as-is AddressFamily.InterNetworkV6 - just represents scopeId (effective interface index) and address must be queried from the system additionally
After update to macOS Sequoiaapplication crashes: