Could not load file or assembly 'System.Diagnostics.StackTrace' or one of its dependencies


I keep ending up with this error popping up, and I can't solve it for the life of me. I'm working on an MVC web app in Net Framework 4.6.1, using Entity Framework 6.4. It first popped up this morning, when I had zero references to System.Diagnostics.Stacktrace, it wasn't installed, in packages, or in web config or packages config.

So I installed it. The error remained, the reference has a warning symbol on it that won't go away.

The error reads:

FileLoadException: Could not load file or assembly 'System.Diagnostics.StackTrace, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]

Nuget doesn't have a "" so I downloaded 4.3.0.

I also have:

                <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
                <bindingRedirect oldVersion="" newVersion="" />

in my web config. I've tried changing the value to but that also didn't work.

What's super frustrating about this, is it wasn't a problem in the previous build, that worked fine, but I made some code changes because it was crashing when saving the entity. Those code changes did not involve installing any other frameworks, and the stacktrace doesn't show any of the code I changed using system.stacktrace.

What do I need to do to make this thing go away? It works locally, but not on the server, how do I get the server to recognize a reference to system.diagnostics.stacktrace?

I have no access to the server, and I cannot install Net Framework 4.7 or higher.

asked on Stack Overflow Dec 16, 2019 by Jonathan Kuhl

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0