-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object Reference after updating 1.8.1 -> 1.9 (Elastic.Apm.Agent.Tracer is null) #1254
Comments
What did you change for Debug? Also .NET 4.8 Framework? Here it's a Console Application. |
Thanks for opening @insanity13. We'll need to investigate what caused this and look to fix it |
I've put together a simple using System;
using Elastic.Apm;
namespace ApmAgentGitHub1254
{
class Program
{
static void Main(string[] args)
{
var transaction = Agent.Tracer.StartTransaction("foo", "bar");
transaction.End();
}
}
} But I'm unable to replicate the null reference exception. @insanity13 or @iqmeta, are you able to replicate the exception with a simple example? |
Sure, here a project to easy reproduce.. Guess it's with the Agent.Setup() Config we use like here you do in your Tests |
I've debug my app it crashed on CentralConfigFetcher and MetricsCollector initialization. I have
In my app, removed it, and it helps. If TracerInternal initialization was earlier, or the initialization of CentralConfigFetcher would have been in the try catch, then Agent.Tracer will work. @russcam The main reason why didn't we see the error - is the incorrect logging: I think it should be fixed. |
Your sample works on my side (but I've changed the framework to 4.6.1 since I have no 4.6.2). @iqmeta you can download 1.9 Source Code (https://github.com/elastic/apm-agent-dotnet/releases/tag/1.9.0) |
You're right. So I did bring in the other nuget packages... I try it also with the source myself. |
@iqmeta you got the same issue. Check your assembly bindings
But I'm not sure if it can be safely removed for your application. |
Yes. Thanks. Nuget Update killed it. Also think this should be fixed. |
Thanks for all the info @insanity13 and @iqmeta.
@iqmeta does this mean that you had the same binding redirect in place prior to updating to The fact that the agent initialization fails with an AssemblyLoadException due to not finding |
@russcam I apologize for the silence. I'll investigate it next week. |
This commit fixes a bug in logging an exception that may occur during agent initialization; the Logger property is used instead of the logger argument, the former will always be initialized with a value. Fixes elastic#1254
Thanks @insanity13, I've opened #1305 to fix |
This commit fixes a bug in logging an exception that may occur during agent initialization; the Logger property is used instead of the logger argument, the former will always be initialized with a value. Fixes #1254
I apologize for not respond as I promised. |
APM Agent version
Elastic.Apm 1.9.
Environment
Windows
.Net Framework 4.7.2
Describe the bug
It looks like Elastic.Apm.Agent.Tracer behavior changed in 1.9 (previously was 1.8.1)
In DEBUG mode (local execution) we don't Initialize APM.
After updating the assembly Elastic.Apm.Agent.Tracer became null
For example, we have an Object reference
var transaction = Elastic.Apm.Agent.Tracer.StartTransaction(FullName, ApiConstants.TypeRequest);
It is not critical, I've fixed it all on our side. This Issue FYI only, feel free to close it.
The text was updated successfully, but these errors were encountered: