Summary

AppDynamics has discovered an issue triggered when the .NET agent attempts to instrument any async method encapsulated in a generic class or method. In most cases this will result in a System.Runtime.InteropServices.SEHException. In rare cases, an application hang could result.

Affected Software

Product

Component

Version

AppDynamics .NET APM.NET Agent4.1 versions below 4.1.3

Impact

Application Exception : Instrumentation of a method described in the Summary will result in an SEHException. 

Examples

// An async method called inside of a generic class will trigger the exception.
class GenericClass<T>
{
   async Task AsyncMethod()
   {
   //Do work...  

   }
}

// An async method called inside of a generic method will also trigger the exception.
class MyClass
{
   public async void MyMethod<T>(T input)
   {
      await AsyncMethod();
   }
}
CODE

Workaround 

  • Customers running version 4.1.0 – 4.1.2 versions of the agent are advised to upgrade to 4.1.3 or later, or
  • Edit the .NET Agent Configuration file to disable the AsyncStateMachineInstrumentor, as described in the following steps.

To disable AsyncStateMachineInstrumentor:

  1. Open the following file, depending on your version of Windows:
    • Windows Server 2008 and later:
      %ProgramData%\AppDynamics\DotNetAgent\Config\config.xml
    • Windows Server 2003:
      %AllUsersProfile%\Application Data\AppDynamics\DotNetAgent\Config\config.xml
  2. Replace or update the <machine-agent> node to include:

    <machine-agent>
       <instrumentation>
          <instrumentor name="AsyncStateMachineInstrumentor" enabled="false" />
       </instrumentation>
    </machine-agent>
    CODE
  3. Restart the AppDynamics.Agent.Coordinator service and then all instrumented processes.