How to identify dependency chain endpoints.MapControllers is erroring on

268 views Asked by At

I have an API solution that's erroring out on Startup when MapControllers is called.

        app.UseEndpoints(endpoints =>
        {
            endpoints.MapControllers();
        });

The error itself is

System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types. Could not load type 'MyNamespace.Result' from assembly 'MyNamespace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

I know this is tied to updates we've made in Nuget packages using the MyNamespace namespace.
The solution builds and I've been manually tracking into the dependency chains of Nuget packages without finding the missing update.

What I'm trying to find out is which chain of dependencies is leading to this error. Any suggestions for pinning down what it's trying to load that still depends on the deprecated copy of my Nuget package?

1

There are 1 answers

1
rbennett485 On BEST ANSWER

Run a restore and have a look in your obj/project_assets.json - this contains a list of all packages which your project depends on (including transitive dependencies), and each of those is listed along with its (direct) dependencies.

You can use this to trace it back to a package you depend on directly