Troubleshooting steps to identify and resolve the crashing issue while monitoring the applications in SharePoint/Multiple domain assembly environments

Troubleshooting steps to identify and resolve the crashing issue while monitoring the applications in SharePoint/Multiple domain assembly environments

If you encounter the exception "Loading this assembly would produce a different grant set from other instances" while running the APM Insight .NET agent, follow these steps to identify and resolve the issue:

Understanding:

Our APM Insight .NET agent modifies IL code at runtime.Hence, It is required to run the application in full trust environments and in single domain mode. In multiple domain scenarios, when "LoadOptimization" is set to 2, issues may arise due to shared assembly and security configurations.

Identify this Crashing issue with Agent Logs:

1. Navigate to C:\ProgramData\DotnetAgent\AgentLogs and open DotNetAgentManaged.ROOT.w3wp.<PID>-11-29-2023.log.
2. Look for exception entries like the below example:

DotAgentManaged.ROOT.w3wp.<PID>-11-29-2023.log
  1. 12/27/2023 2:52:00 PM - [4:(DEBUG)<t:16>] - [TName: ]Creating root tracker.. 
  2. 12/27/2023 2:52:00 PM - [4:(DEBUG)<t:16>] - [TName: ]The uri is /Pages/default.aspx 
  3. 12/27/2023 2:52:00 PM - [4:(DEBUG)<t:16>] - [TName: ]Root tracker for the transaction DotNetAgent.Sequences.Sequence is System.ServiceModel.Channels.ServiceChannelProxy.InvokeService 
  4. 12/27/2023 2:52:00 PM - [4:(DEBUG)<t:16>] - [TName: ]Call stack count: 1 
  5. 12/27/2023 2:52:01 PM - [0:(CRITICAL)<t:16>] - Exception captured.An Error occured during https://xxxxxxxxxx/Pages/default.aspx request/response. Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
  6. 12/27/2023 2:52:01 PM - [4:(DEBUG)<t:16>] - [TName: ]Exception Tracker Created. 

Identify this Crashing issue with Application Page:

1. Check the application crashing page for exception information like below:

Identify this Crashing issue with Event Viewer logs:

1. Open Event Viewer and navigate to Windows Logs -> Application.
2. Click the event with the source like Application Error or Microsoft-SharePoint products to verify the exception.




Solution:

Note: For SharePoint environments, the workaround might not work, as the app DLL itself is designed for multiple domain assembly. In such cases, contact support with UAT setup to explore the possibility of supporting it.

Follow the below steps to resolve the exception:
  1. Add   <trust level =”Full”/>    under the block in the application web.config file. In most cases, this will resolve the issue. If the issue is not resolved with this step, proceed to the next step.
  2. Set loader optimization to single domain mode. [Note: This second step is not recommended for Share Point applications.]
    1. For 64 bit applications:
      1. Open Registry Editor and navigate to the below path, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework"
      2. Create a new registry DWORD value called "LoaderOptimization" and set the value as 1.
    2. For 32 bit applications:
      1. Open Registry Editor and navigate to the below path, "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework"
      2. Create a new registry DWORD value called "LoaderOptimization" and set the value as 1.
  3. Reset IIS and access your application. 


   If the issue persists, Kindly contact the support@manageengine.com along with the updated Agent diagnostics
                  New to ADManager Plus?

                    New to ADSelfService Plus?