I was trying to get a library that required System.Threading.Dll to work with my .NET 3.5 web application project. Since 3.5 doesn't have System.Threading.Dll, I followed a tip to install the Reactive extensions because it has a backported version of System.Threading for 3.5.
The attempt still failed and after enough frustration I backed out abandoned the branch entirely.
Now in my original branch that didn't have any of the experimental work, I'm getting this error.
[BadImageFormatException: Could not load file or assembly 'System.Reactive.Windows.Threading' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.]
The error makes sense. What doesn't make sense is why is it even attempting to load the System.Reactive.Windows.Threading assembly in the first place? There is no reference to it in the solution. I even went as far as uninstalling the extensions altogether from the OS.
Here's the binding info.
=== Pre-bind state information ===
LOG: User = IIS APPPOOL\.NET v2.0
LOG: DisplayName = System.Reactive.Windows.Threading
(Partial)
LOG: Appbase = file:///C:/GitHub/v44/Web/
LOG: Initial PrivatePath = C:\GitHub\v44\Web\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\GitHub\v44\Web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/root/65a2449d/ebe221c1/System.Reactive.Windows.Threading.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/root/65a2449d/ebe221c1/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.DLL.
LOG: Attempting download of new URL file:///C:/GitHub/v44/Web/bin/System.Reactive.Windows.Threading.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.
What is making .NET think it needs to load this assembly?
Found it. So there were genuinely no dependencies to the reactive extension left in my solution. However the old libraries that needed it were still left in my bin folder. Uninstalling the nuget packages doesn't remove them. Once the nuget packages are removed, it appears a Clean doesn't remove them.
Here's what I think happened. So there they are sitting in my bin folder which is ignored by git so switching branches doesn't remove them. .NET sees them in the bin folder and despite nothing needing them tries to load them. I had to completely clean out the workspace of all ignored files as well.
git clean -fxd
Build from there and I'm good to go.
When you say you "installed" Rx what do you mean? Which NuGet package did you use? What Rx references does your project have? Make sure you just use Rx-Main
. It sounds like you might have used one of the flavors that includes Rx-Xaml (such as Rx-WPF or Rx-Silverlight). Rx-Xaml loads System.Reactive.Windows.Threading.
http://blogs.msdn.com/b/rxteam/archive/2012/08/15/reactive-extensions-v2-0-has-arrived.aspx describes the different packages and what they include.
User contributions licensed under CC BY-SA 3.0