Skip to content

Could not load file or assembly 'Microsoft.AspNetCore.Diagnostics.Abstractions' with .net 7.0.5 #48244

Open
@tygore587

Description

@tygore587

Description

We are experiencing a problem with our .net mvc api running in service fabric which is getting the error Could not load file or assembly 'Microsoft.AspNetCore.Diagnostics.Abstractions.

The compile target is .net 7.

I search for other bugs and found the issue dotnet/runtime#3252 and searched for direct package references in our project, but found none.

We deploy the api as a self contained package, so the host runtime shouldn't matter?

Reproduction Steps

The problem is, that I can't reproduce it locally. It just happens, when it is deployed. But we can't find the cause.

Expected behavior

Not seeing an error

Actual behavior

Throws an exception:

Could not load file or assembly 'Microsoft.AspNetCore.Diagnostics.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
Type: System.IO.FileNotFoundException
File not found: Microsoft.AspNetCore.Diagnostics.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Stack Trace: at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.HandleException(HttpContext context, ExceptionDispatchInfo edi)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.HandleException(HttpContext context, ExceptionDispatchInfo edi)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
at Microsoft.AspNetCore.Server.HttpSys.RequestContext`1.ExecuteAsync()
at Microsoft.AspNetCore.Server.HttpSys.RequestContext`1.ExecuteAsync()

Regression?

It worked for month using .net 6 before. We just started to see this happen after upgrading to .net 7

Known Workarounds

We don't have one.

Configuration

  • Which version of .NET is the code running on?
    .net 7.0.5

  • What OS and version, and what distro if applicable?
    Windows Server 2022

  • What is the architecture (x64, x86, ARM, ARM64)?
    x64

Other information

If you need more information, please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresfeature-diagnosticsDiagnostic middleware and pages (except EF diagnostics)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions