Thread Stopping by Itself?

From what I’ve read in the documentation, this isn’t supposed to be possible. Yet I have a situation where a Thread just seems to stop by itself:

The basic code in my thread run event is:

// Loop through received packets
Do
  
  // Wait for next packet
  Do Until udp.PacketsAvailable > 0
    thr.Sleep(1)
  Loop
  
  // Read Datagram
  dim dg as Datagram = udp.Read
  
  // Parse Packet
  ParsePacket(dg)
  
Loop

This should effectively run as an infinite loop that sleeps until UDP datagrams arrive on a socket and then passes them to the ParsePacket method for further processing. However, after about 5 secs of running everything seems to stop. I check the debugger and the Thread state is showing as “NotRunning”, despite there being no code that would have stopped the thread intentionally.

Does anyone know if there’s anything else I can look for that might cause a thread to break silently like this?

This was tested on Xojo 2025r2

Sockets run on the main thread. But i don’t see an issue here.