How can I trace failed assembly binding in a dotnet core web project (running in IIS Express)

Viewed 249

I'm struggling to find why a certain assembly is not loaded in a dotnetcore 3.1 webproject

(I'm getting Could not load file or assembly 'MyCool.Services.Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null')

If this was a netFw project I would simply fire up Fuslogvw and find a lot of information about why the assembly binding fails.

Maybe I've overlooked, but I haven't found an alternative way to find this kind of information for a dotnet core project.

A previous post asked it here but doesn't have an answer : What's the replacement for fuslogvw in .net core 2?

I also already followed the advice of this SO post : Inspect dependencies for dynamically loaded library in .net core and set COREHOST_TRACE=1 in the package manager console.

enter image description here

But it seems it's not useful for web projects running is IIS express.. (the log states dotnet : Couldn't find a project to run. while I have my project started)

Any advice on how the trace my failed assembly binding would be much appreciated !

1 Answers

Ok, a bit more perseverance in Googling helped me out....

It turns out that Microsoft has already given us a new "dotnet-trace analysis utility" and a ton of documentation on how to trace assembly loading.

Steps to use this are :

  1. Install the dotnet-trace utility using dotnet tool

PM> dotnet tool install --global dotnet-trace

  1. Identify the pid of your running application in iis express

PM> dotnet-trace ps

  1. Start tracing :)

PM> dotnet-trace collect --providers Microsoft-Windows-DotNETRuntime:4 --process-id <pid>

  1. Finally open the trace.nettrace file with the perfview tool from Github/microsoft/perfview

I hope this info helps others in not loosing too much time googling around for "how to fuslogvw in dotnetcore" :)

Related