0

I have a problem with the rabbitmq.client version when using easynetq but I do not know what EXACTLY is causing it! My solution contains a project for a WindowsService (exe file) and several library projects, all built against .NET 4.6.2.

In my exe.conf (of the service executable) file I see the following entry:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="RabbitMQ.Client" publicKeyToken="89e7d7c5feba84ce" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
  </dependentAssembly>
</assemblyBinding>
</runtime>

This causes a crash with the following exception:

2017-10-20 09:58:49,185; [9]; INFO ; MqService1Log; [AppHost.Configure]; - Registering RabbitMQ server using the EasyNetQ library....
2017-10-20 09:58:49,260; [9]; ERROR; MqService1Log; [Program.Main]; - System.IO.FileLoadException: Die Datei oder Assembly "RabbitMQ.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)
Dateiname: "RabbitMQ.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce" ---> System.IO.FileLoadException: Die Datei oder Assembly "RabbitMQ.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)
Dateiname: "RabbitMQ.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce"

=== Zustandsinformationen vor Bindung ===
LOG: DisplayName = RabbitMQ.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce
 (Fully-specified)
LOG: Appbase = file:///D:/Projects/BizBusMQSamples/MqService1/MqService1/MqService1/bin/Debug/
LOG: Ursprünglicher PrivatePath = NULL
Aufruf von Assembly : EasyNetQ, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null.
===
LOG: Diese Bindung startet im default-Load-Kontext.
LOG: Die Anwendungskonfigurationsdatei wird verwendet: D:\Projects\BizBusMQSamples\MqService1\MqService1\MqService1\bin\Debug\MqService1.vshost.exe.Config
LOG: Die Hostkonfigurationsdatei wird verwendet: 
LOG: Die Computerkonfigurationsdatei von C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config wird verwendet.
LOG: In der Anwendungskonfigurationsdatei wurde eine Umleitung gefunden. 4.0.0.0 wird nach 5.0.0.0 umgeleitet.
LOG: Verweis nach der Richtlinie: RabbitMQ.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce
LOG: Die gleiche Bindung ist bereits aufgetreten und hat den Fehler hr = 0x80131040 verursacht.

   bei System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   bei System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   bei System.Reflection.RuntimeMethodInfo.GetParameters()
   bei System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat)
   bei System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   bei System.Exception.GetStackTrace(Boolean needFileInfo)
   bei System.Exception.ToString(Boolean needFileLineInfo, Boolean needMessage)
   bei System.Exception.ToString(Boolean needFileLineInfo, Boolean needMessage)
   bei System.Exception.ToString()
   bei System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
   bei System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
   bei System.String.Format(String format, Object arg0, Object arg1)
   bei MqService1.AppHost.Configure(Container container) in D:\Projects\BizBusMQSamples\MqService1\MqService1\MqService1\AppHost.cs:Zeile 51.
   bei ServiceStack.ServiceStackHost.Init()
   bei MqService1.Program.Main(String[] args) in D:\Projects\BizBusMQSamples\MqService1\MqService1\MqService1\Program.cs:Zeile 30.

Something seems to require RabbitMQ.Client 5 while something else wants Version 4. Since EasyNetQ seems not to support 5.0.1 (I get an unknown method error in the connection factory when connecting), I did NOT upgrade to 5.0.1 and stay with RabbitMQ.Client 4.1.3.

If I change bindingRedirect to oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" (change version from 5 to 4) in the .conf file everything works fine. The problem is, that every time I build the project this is changed back to 5 again!

Maybe I have to add the following information: The solution contains a library project that contains some management functions. This project includes EasyNetQ.Management.Client but according to the NuGet information it has NO dependencies. However when I remove this library project from my solution, the config file is not changed.....

Any idea what is going on here and how I can solve it? Any help is greatly appreciated.

EDIT

If I remove the library project from the solution, it still changes my config file to version 5. It must be caused by something else.

ThommyB
  • 1,456
  • 16
  • 34

1 Answers1

0

Update @ThommyB : I just released EasyNetQ 2.2.0, care to try?


I have not seen this behavior before, I suspect there's still references or packages to RMQ 5.

Would you mind updating to this version? https://www.nuget.org/packages/EasyNetQ/2.3.0-alpha0002

That will get you the RabbitMQ 5 client. Not many other things have changed so I don't consider it a big risk.

Wiebe Tijsma
  • 10,173
  • 5
  • 52
  • 68
  • With the update it works again. Hope to see the final soon, working with a version marked as 'alpha' is not production-ready in my environment. But thanks for the help! – ThommyB Oct 24 '17 at 05:48