Why I get errors in the class ApplicationInsightsHttpModule in method OnExecuteRequestStep

Perepelytsia, Denys 0 Reputation points
2023-08-09T09:00:06.68+00:00

Hello, I have a question for you, is this behavior normal or not?

After adding Application Insights to Web Forms, I noticed that during compilation in Out put, many errors like "Exception thrown: 'System.ArgumentException' in mscorlib.dll" are displayed

I found these errors appear in the ApplicationInsightsHttpModule class in the OnExecuteRequestStep method when it tries to find files using paths and encounters folders

User's image

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,572 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,181 Reputation points Microsoft Employee
    2023-08-10T21:57:05.29+00:00

    Hi @Perepelytsia, Denys

    This issue isn't necessarily related to Azure Monitor. It's more related to C# and Visual Studio. However, for the community to best assist, you need to elaborate more on your machine setup.

    I didn't experience any build issues and my project is .NET 4.7.2 Web Forms project in Visual Studio 2022 17.8.0 with Application Insights 2.21.0.249, the latest nuget package, referenced (project snippet below, sections omitted for brevity)

    <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <Import Project="packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
      <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
      <PropertyGroup>
        ...
        <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
        ...
      </PropertyGroup>
      <ItemGroup>
        <Reference Include="Microsoft.ApplicationInsights, Version=2.21.0.429, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
          <HintPath>packages\Microsoft.ApplicationInsights.2.21.0\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
        </Reference>
      </ItemGroup>
    </Project>
    

    In checking OnExecutingRequestStep in ApplicationInsightsHttpModule class, it looks like it may be trying to restore some log activity; but without a stacktrace, it's difficult to say. It may be writing/reading this activity from disk, and based on the messages you're shared, it may be an issue with the path. You can use tools like ProcMon to see what path the module is actually to trying to write/read to/from.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.