sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.43k stars 433 forks source link

Unhandled exception. System.InvalidOperationException: Collection was modified #1173

Open greco-salvatore opened 1 week ago

greco-salvatore commented 1 week ago

We are experiencing the same exception as in #902, but i can't re-open the issue

We are actually using the SIPSorcery 6.2.4 on a Windows-x64 based environment.

2024-09-09T15:05:43.7628253+02:00  [FTL] Unhandled exception being thrown with Message: [Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at SIPSorcery.Net.RtpIceChannel.ProcessChecklist()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()] (1bacd926)

The exception can't be handled outside the library and is being thrown in the application who uses it, causing a crash.

I haven't checked if the problem can be solved using the suggestion in the past closed issue. Can you look at it? Thanks

ChristopheI commented 1 week ago

Could you check if the suggestion is working in your case and create a PR ? Thx

greco-salvatore commented 1 week ago

Well, i can't really reproduce the crash programatically but it happens every so often. I'll keep you updated if the fix is working