ELK APM .NET System.NullReferenceException

Kibana version: 8.5.3

Elasticsearch version: 8.5.3

APM Server version: 8.5.3

APM Agent language and version: C# .NET 4.7.3,

Agent Profiler Version: v1.19.0
Browser version: N/A

Profiler Auto instrumentation: Internet Information Services (IIS) .NET Framework.

Hi, I was testing .NET Apm. I got this error when I checked \elastic\apm-agent-dotnet\logs.

[ERROR] exception whilst instrumenting integration <Elastic.Apm.Profiler.Managed.Integrations.AdoNet.CommandExecuteNonQueryIntegration, Oracle.ManagedDataAccess.Client.OracleCommand>
System.NullReferenceException: Object reference not set to an instance of an object.
   at Elastic.Apm.Model.Span.TryToCompressRegular(Span sibling)
   at Elastic.Apm.Model.Span.TryToCompress(Span sibling)
   at Elastic.Apm.Model.Span.End()
   at Elastic.Apm.Model.DbSpanCommon.EndSpan(ISpan span, IDbCommand dbCommand, Outcome outcome, Nullable`1 duration)
   at Elastic.Apm.Profiler.Managed.Integrations.AdoNet.DbSpanFactory`1.EndSpan(ApmAgent agent, IDbCommand command, ISpan span, Exception exception)
   at Elastic.Apm.Profiler.Managed.Integrations.AdoNet.CommandExecuteNonQueryIntegration.OnMethodEnd[TTarget,TReturn](TTarget instance, TReturn returnValue, Exception exception, CallTargetState state)
   at CommandExecuteNonQueryIntegration.OnMethodEnd.OracleCommand.Int32(OracleCommand , Int32 , Exception , CallTargetState )
   at Elastic.Apm.Profiler.Managed.CallTarget.Handlers.EndMethodHandler`3.Invoke(TTarget instance, TReturn returnValue, Exception exception, CallTargetState state)
   at Elastic.Apm.Profiler.Managed.CallTarget.CallTargetInvoker.EndMethod[TIntegration,TTarget,TReturn](TTarget instance, TReturn returnValue, Exception exception, CallTargetState state)
   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery()

I followed the steps here.( Profiler Auto instrumentation)

There was no problem with the installation. We were seeing services and traces but still wondering about this error. Do I need to worry about this?

Hi @aysekisik_kisilan,

thanks for reporting this. You might have discovered a small issue here (that should not impact your application, however).

Do you have a Kibana screenshot that you could post here by any chance?
I would be interested if you are seeing any database spans and what their names are.


Hi @Wolfgang_Ziegler ,
Thank you for your reply. Are these screenshots helpful to you?

Thank you

Yes, that's helpful, thanks!

Would you want to try out a beta version to see if the exception log goes away or do you want to wait for the next release?

(As I said, it's not a serious bug though)

1 Like

@Wolfgang_Ziegler thank you,
If it's not a serious problem, I can continue to use it as v1.19.0. How can I stop elastic_apm_profiler? Is it enough to remove the variables that I have set to iis pools? and Do I need to restart iis after remove?

Yes, removing the environment variables and restarting the IIS app pools stops the profiler.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.