2

I am getting the following runtime exception, except I think my case is different than the dozen or so I've seen so far, most of which are a couple years old.

Could not load file or assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

We had been using System.ValueTuple and ran into these common issues back when they first incorporated the library into the core language. Since then we have removed all references to the old nuget package and all projects target 4.7.

Since then we have been successfully using the ValueTuple constructs throughout our solution without any problems. Until now, I have a specific call that fails, while other calls that return a ValueTuple succeed, from within the same method. I don't know what the difference could be since all the calls use custom objects serialized across a SignalR hub through an interface like:

Task<(MyObject myobj, Guid myguid)> GetStuffd(Guid id);

I bumped all our projects to 4.7.2. I removed every binding redirect in every app.config file. Still nothing. And since other ValueTuple calls work from the same project, I don't think I'm on the right track with these kinds of solutions. Any ideas?

grinder22
  • 551
  • 4
  • 17
  • At what point is the exception thrown? It would usually happen at the time that it is needed. So knowing what line the exception is thrown might help figure this out. – Gabriel Luci Dec 03 '19 at 22:16
  • I think I found it. All my focus was on the client side, as my calls were not even hitting server-side break points. Turns out the failure was server-side and getting thrown before I ever got into my signalR methods. – grinder22 Dec 03 '19 at 22:46

1 Answers1

1

The problem was actually server-side and removing the binding redirect from my host service easily solved the problem.

It's worth noting that a new .Net Standard 2.0 library was the catalyst here. My call down into a .Net Standard class library is what prompted the issue. This is what was different from other calls already using ValueTuple.

Clearing the binding redirects was indeed the solution after all.

grinder22
  • 551
  • 4
  • 17