fluentassertions / fluentassertions.json

NewtonSoft.Json extensions for FluentAssertions
Apache License 2.0
72 stars 26 forks source link

The latest FluentAssertions.Json 5.5.0.0 fails at runtime if the FluentAssertions version is not 5.10.2.0 (which is not the latest available version) #50

Closed mlaily closed 3 years ago

mlaily commented 3 years ago

Basically, we can't use the latest FluentAssertions version or FluentAssertions.Json crashes:

System.IO.FileLoadException : Could not load file or assembly 'FluentAssertions, Version=5.10.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
=== Pre-bind state information ===
LOG: DisplayName = FluentAssertions, Version=5.10.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a
 (Fully-specified)
LOG: Appbase = file:///[TRUNCATED]/bin/Debug/net472/
LOG: Initial PrivatePath = NULL
Calling assembly : FluentAssertions.Json, Version=5.5.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\[TRUNCATED]\bin\Debug\net472\[TRUNCATED].dll.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: FluentAssertions, Version=5.10.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a
LOG: Attempting download of new URL file:///C:/[TRUNCATED]/bin/Debug/net472/FluentAssertions.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

It might be possible to work around this with binding redirects, but it was easier to downgrade FluentAssertions to 5.10.2.0.

(I created this issue primarily so others would not waste as much time as me on this :) )

jnyrup commented 3 years ago

Hi @mlaily

Two things are going on here:

In #43 we fixed an inconsistency where the nuget package said FluentAssertions.Json depends on FluentAssertions 5.0.0, while FluentAssertions.Json.dll actually depended on FluentAssertions.dll 5.10.2 image This fix has not yet been released.

As FluentAssertions' AssemblyVersion follows its Version, FluentAssertions.Json will require binding redirects for package.config style csproj to load a newer version of Fluent Assertions.