|License Type||SaaS & On-Premise|
|Agent Mode||Assess & Protect|
|Main Product Category||.NET Agent|
|Sub Category||Runtime Exception|
An application using a Ninject version prior to 3.2.3 throws an unhandled
InvalidProgramException when the .NET agent is running:
> InvalidProgramException: Common Language Runtime detected an invalid program. System.Runtime.CompilerServices.RuntimeHelpers._CompileMethod(IRuntimeMethodInfo method)
This bug is a known issue with Ninject vs. instrumenting profilers:
This bug was fixed and the PR included newer versions of Ninject:
Use one of the following strategies to resolve the issue.
Update the application to use Ninject version 3.2.3 (e.g., https://www.nuget.org/packages/Ninject/3.2.3-unstable-012) or greater.
Add code to the application to work around the bug in Ninject. You can find the code at https://github.com/ninject/Ninject/issues/175 by searching for "Kernel.Components.RemoveAll();".