I recently installed a NuGet package into one of the projects in my solution. There were no issues during installation. There are no issues with building my code, rebuilding my code, or starting up the code for debugging in Visual Studio. However, while debugging, whenever my code reaches a point where it would call .Where() on an IQueryable, I get an error:
Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Notably, this ONLY happens if I make use of the new NuGet package in my code - for example, by calling a constructor or function from it. If I don't use it at all, or if I just have "using" statements pointing to it but don't do anything with them, I do not get this error.
Nothing in my solution references System.Runtime.Loader at all. In fact, as far as I can tell, nothing in the NuGet package references System.Runtime.Loader either. Also, nothing that references any part of "System.Runtime" references version 4.0.0.0. So I have no idea why the code is looking for this file, or how I can fix this situation. (I also have no idea why this error only occurs when trying to execute .Where() on an IQueryable. The exact same uses of .Where() work fine as long as the new package contents are not being referenced anywhere in my code.)