microsoft / ApplicationInsights-SDK-Labs

Application Insights experimental projects repository
MIT License
61 stars 48 forks source link

DependencyCallStacks loading error #1

Closed rwatjen closed 9 years ago

rwatjen commented 9 years ago

I'm getting an error when adding DependencyCallStacks to my ApplicationInsights.config. It looks like AI wont load the DLL, but the Fusion assembly binding log indicates that the Microsoft.AI.DependencyCallstacks.dll was loaded successfully.

The Windows event log contains this stack trace:

Service cannot be started. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Type 'Microsoft.ApplicationInsights.DependencyCallstacksTelemetryInitializer, Microsoft.AI.DependencyCallstacks' could not be loaded.
   at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.CreateInstance(Type interfaceType, String typeName)
   at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.LoadInstance(XElement definition, Type expectedType, Object instance)
   at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.LoadInstances[T](XElement definition, ICollection`1 instances)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] a...

How can I trace what's going on? This doesn't happen when running the code in VS, only on the server running the software I want to track.

rwatjen commented 9 years ago

My bad. There is an assembly binding error. It looks to me like the AI SDK 1.2.3.490 doesn't play well with Microsoft.AI.DependencyCallstacks version 0.20.0.17454 which is the latest available at MyGet.

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\BPCloud\MSS\StatusServerService.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.ApplicationInsights, Version=1.2.0.5639, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files/BPCloud/MSS/Microsoft.ApplicationInsights.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\BPCloud\MSS\Microsoft.ApplicationInsights.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.ApplicationInsights, Version=1.2.3.490, Culture=neutral, PublicKeyToken=31bf3856ad364e35
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

I'll build the Telemetry Initializer from source and use that instead.