In a .dll I have got a method to send an Azure Event.
It runs, when I call it from an executable. When I call it from an from an plug in, I get Null reference exception from the Microsoft.ApplicationInsights.Workerservice.dll These are the lines, where it happens:
*TelemetryConfiguration configuration = new TelemetryConfiguration(orchestrationKeyToUse);
IServiceCollection services = new ServiceCollection();
services.AddSingleton<ITelemetryInitializer, KnaufCustomTelemetryInitializer>();
**services.interface call(orchestrationKeyToUse);***
In the bold line it throws the exeption.
I tried to call it from the plugin in a interface call and I tried to start a thread to call the method. In both cases it throws an exception. Called from an executable, it runs without problems. Any ideas, why?