ELK APM .NET System.NullReferenceException

We're using the Elastic.Apm NuGet package and noticed that it threw a NullReferenceException in the ElasticActivityListener.

The stack trace is:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Elastic.Apm.Model.Span.<End>g__QueueSpan|117_0(Span span)
 
   at Elastic.Apm.Model.Span.End()
 
   at Elastic.Apm.OpenTelemetry.ElasticActivityListener.UpdateSpan(Activity activity, Span span)
 
   at Elastic.Apm.OpenTelemetry.ElasticActivityListener.<get_ActivityStopped>b__21_0(Activity activity)
 
   at System.Diagnostics.SynchronizedList`1.EnumWithAction(Action`2 action, Object arg)
 
   at System.Diagnostics.Activity.Stop()

APM Agent language and version:
.NET NuGet package, Elastic.Api. Version: 1.30.1
.NET version: 8

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):

It doesn't happen all the time, we've been running the Elastic.Apm package for a long time in multiple internal applications and this is the first time I've seen this error so it seems very hard to reproduce.