Exception while sending message to Azure Service Bus Topics

0

While sending messages to Azure Service Bus Topics from existing .Net application, I am getting following exception

The type initializer for 'Azure.Messaging.ServiceBus.Core.ClientLibraryInformation' threw an exception. Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The above is working fine in a new .Net Core application. I am unable to find out what is wrong.

c#
azureservicebus
azure-servicebus-topics
asked on Stack Overflow Feb 21, 2021 by Anil C • edited Feb 21, 2021 by Filburt

2 Answers

0

In .NET, dependency conflicts occur when two versions of the same assembly are loaded into the same Assembly Load Context. This conflict is a common problem that occurs in any software where versioned dependencies are used. Because there are no simple solutions, and because many dependency-resolution frameworks try to solve the problem in different ways, this situation is often called "dependency hell".

Conflict issues are compounded by the fact that a project almost never deliberately or directly depends on two versions of the same dependency. Instead, the project has two or more dependencies that each require a different version of the same dependency.

For example, say your .NET application, DuckBuilder, brings in two dependencies, to perform parts of its functionality and looks like this:

enter image description here

Because Contoso.ZipTools and Fabrikam.FileHelpers both depend on different versions of Newtonsoft.Json, there may be a dependency conflict depending on how each dependency is loaded.

answered on Stack Overflow Feb 22, 2021 by Frank Gong
0

I had to manually update the references. When I did this, the method started working fine.

answered on Stack Overflow Feb 22, 2021 by Anil C

User contributions licensed under CC BY-SA 3.0