Reputation: 51
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?
Upvotes: 4
Views: 3218
Reputation: 242
Restarting the Azure App service solved the issue for me. My application was build with .NET Framework 4.6.1 and Azure App service was running on ASP.NETv4.7 32 bit.
Upvotes: 0
Reputation: 672
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
Upvotes: 3
Reputation: 21
I had the same problem. Solution was to change .NET framework from 461 to 462.
Upvotes: 2