Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load type 'System.Diagnostics.ProductionBreakpointsStub Error in app deployed in Azure

I have an application deployed in Azure, since this morning I starting receiving this error:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Diagnostics.DiagnosticListener' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Diagnostics.ProductionBreakpointsStub' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at __EnsureBootstrap__System.Diagnostics.DiagnosticSource.dll() at System.Diagnostics.DiagnosticListener..cctor() --- End of inner exception stack trace --- at System.Diagnostics.DiagnosticListener..ctor(String name) at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors) at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at MotionCatalyst.Online.Program.Main(String[] args)

My application is a asp.net core app but target the full framework.

This is the project file:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
    <RuntimeIdentifier>win7-x86</RuntimeIdentifier>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
  </PropertyGroup>

Locally is working. any help?

like image 955
Marcus Guedes Avatar asked Mar 08 '23 13:03

Marcus Guedes


1 Answers

I think there might be a bug in current version of Application Insights extension (2.4.7). Does the error go away if you remove the extension from App Service?

The other workaround would be to delete following files manually, but I suppose it also disables the snapshot debugging functionality:

d:\home\SiteExtensions\Microsoft.ApplicationInsights.AzureWebSites\Instrumentation32\ProductionBreakpoints_x86.config

d:\home\SiteExtensions\Microsoft.ApplicationInsights.AzureWebSites\Instrumentation64\ProductionBreakpoints_x64.config 
like image 56
Juha Avatar answered Mar 10 '23 07:03

Juha