Using older versions of Ninject with .Net APM agent can cause "InvalidProgramException" errors.

book

Article ID: 6555

calendar_today

Updated On:

Products

APP PERF MANAGEMENT CA Application Performance Management Agent (APM / Wily / Introscope) CUSTOMER EXPERIENCE MANAGER INTROSCOPE

Issue/Introduction

Description:

When using Ninject (http://www.ninject.org/) in conjunction with the .NET Agent, you can receive an error similar to below:

 

 [InvalidProgramException: Common Language Runtime detected an invalid program.]

   System.Runtime.CompilerServices.RuntimeHelpers._CompileMethod(IRuntimeMethodInfo method) +0
   System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType) +38
   Ninject.Injection.DynamicMethodInjectorFactory.Create(ConstructorInfo constructor) +859

Cause

Using a version of Ninject released before August 2015 will produce this error.

Environment

All releases of APM .Net agent running older releases of Ninject.

Resolution

The error is present in versions of Ninject released before August 2015. To fix the issue, download the latest version from http://www.ninject.org/download.html.

There are no workarounds in agent configuration to help this, it requires modifications by the application developers.