Other Known Issues

Loading Assembly Error

Issue

  • A page containing certain ASP.NET controls, such as the legacy ASP.NET ReportViewer control, throws an unhandled exception when the .NET agent is running:

    Loading this assembly would produce a different grant set from other instances

  • The application's web.config file specifies <trust legacyCasModel="true".

Solution

You can't use the Contrast .NET agent with applications using the legacyCasModel="true" setting. Use one of the following strategies to resolve this issue:

  • Set legacyCasModel="false". The ReportViewer control's performance will suffer but will still work.

  • Use the ProcessBlacklist setting to configure the .NET agent to not analyze the application pool containing the application with the ReportViewer control. See the article on Application Pool Filtering for more details.

A Resource Returns 0 Bytes

Issue

  • A particular resource (page, image, etc.) works normally when the .NET agent isn't running, but stops working when the agent is running.

  • When using browser developer tools - or something similar to view network traffic - and the .NET agent is running, the resource returns 0 bytes.

Solution

The .NET aget uses a filter in a System.Web.IHttpModule to gather HTTP response data. There is a known Microsoft bug in the .NET framework: HttpModules with filters can cause resources such as WebResource.axd to return 0 bytes (which can result in 500 status responses for embedded resources such as images). Use one of the following strategies to resolve this issue:

  • Configure the .NET agent using the ResponseUrlWhitelistRegex settings to prevent Contrast from applying the HttpModules filter to the resource. See the .NET Configuration article for more information.

  • Disable collection and analysis of HTTP response bodies by disabling full-content-analysis (<full-content-analysis enabled="false">) in %ProgramData%\Contrast\dotnet\customerPolicy.xml. See the article on Custom Policy for more information.

Third-Party Libraries Not Recognized

Issue

You see certain third-party libraries marked as Unknown or gray in Contrast.

Solution

There is no action to take at this time.

Contrast uses a database of library file hashes to identify libraries. This library database is based on information from the Nuget package repository (the de facto standard repository for .NET libraries). Most popular third-party libraries such as Entity Framework are published on Nuget. However, Contrast doesn't identify the libraries that aren't published in the repository, including most first-party Microsoft libraries such as System.Data or System.Web (but not System.Mvc). Contrast may identify more first-party libraries in future versions.

Invalid Program Exception

Issue

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) System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType)

This bug is a known issue with Ninject vs. instrumenting profilers: https://github.com/ninject/Ninject/issues/175. This bug was fixed and the PR included newer versions of Ninject: https://github.com/ninject/Ninject/pull/179.

Solution

Use one of the following strategies to resolve the issue.

Another IIS Profiler Detected

Issue

The .NET agent doesn't start, and the following error message is displayed in the Tray application:

> *The Contrast .NET service cannot start with another profiler attached to IIS. COR_ENABLE_PROFILING: 0x01, COR_PROFILER: {BX7CFC47-3E35-2c2e-B495-534F93B28123}, COR_PROFILER_PATH:...*

The CLR Profiling API only allows a single agent to be attached to a .NET process. The Contrast .NET agent uses the Profiling API to perform data/code flow analysis and detect libraries used by the application.

Note: Many performance/APM tools - such as New Relic, AppDynamics and Dynatrace - also use the CLR Profiling API.

Solution

To resolve the issue, Contrast implemented profiler chaining that allows Contrast to run side-by-side with another profiling tool. To enable profiling, see the ProfilerChainingEnabled configuration setting.