-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Dependency inconsistency in Azure.Core (netstandard2.0, affecting multiple SDK packages) #39798
Comments
For this simple reproduction, enabling automatic binding redirects would work. Things are a bit more complicated in a larger solution with multiple web projects and references to various Azure SDK packages. |
Hi @avendel apologies that you are experiencing this issue. We updated our dependency on |
@m-redding Thanks for looking into this. With automatic binding redirects enabled, the problem isn't reproducible. If you use the exact csproj from my minimal reproduction (with automatic redirects disabled), do you get the same exception as me? I have been able to reproduce the issue on a Windows 11 dev workstation and on Windows Server 2022 Data Center Edition, both when built using Visual Studio 2022 and using a dotnet 8 preview SDK. I would expect having to resort to binding redirects with multiple dependencies of different versions. However, in this case I'm only referencing the I agree that it looks like your explicit dependencies seem to be on 6.0.1, but the actual references as specified in the compiled dlls are for 6.0.0. I used both ildasm and dotPeek. See screenshot from dotPeek below: Maybe this is related to how netstandard references are found (https://learn.microsoft.com/en-us/dotnet/standard/assembly/reference-assemblies)? On my computer, they seem to use dlls from C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.x\ref\net6.0, where I find only System.Diagnostics.DiagnosticSource 6.0.0. I don't rule out that there is something in my environment causing this, but since I see other similar issues in this repository (#39632, #38857), I thought it would be worth bringing my findings to your attention. |
Ok after disabling automatic redirects I am seeing the same exception as you. I'm also using Visual Studio 2022 and the latest dotnet 8 preview to run. |
Subject: [BUG] Dependency Inconsistency in Azure.Core (Azure.Storage.Blobs 12.19 and 12.18) affecting .NET Framework Projects Dear Azure.Core and Azure.Storage.Blobs Teams, I hope this message finds you well. I am reaching out to report a bug related to a dependency inconsistency in Azure.Core, specifically affecting versions 1.35.0, Azure.Storage.Blobs 12.19.0, and 12.18.0. This issue arises when using these versions in a .NET Framework project, causing an exception related to System.Diagnostics.DiagnosticSource. Bug Description: Reproduction Steps:
Expected behavior: Actual behavior: Environment: Visual Studio: Enterprise 2022 (64-bit), Current Version 17.7.3 Additional Information: Azure.Core Version: 1.35.0 I appreciate your attention to this matter and look forward to a resolution. If you require further details or clarification, please feel free to reach out. Best regards, |
Hello, apologies again for the difficulties here. I've been investigating this issue and have found some information so far that I wanted to add. I'm going to consult with some other people who have more .NET context in order to get a better idea of how we should move forward. Binding redirects are specific to .NET Framework. .NET core uses
Which is similar to what a binding redirect would do for .NET framework. It seems that the guidelines for avoiding this problem from the .NET team in general is to use binding redirects. The default behavior of a .NET framework desktop app in visual studio uses automatic binding redirection. In addition, I was able to find the following guidance from various sources in the runtime repository:
I'm not entirely certain why this change would be breaking only for Azure.Core 1.34 and beyond. I tested this exact same app with With all that being said, I do not think this is desirable behavior. Especially given that it is impacting so many people, and (as you mentioned) automatic redirects are not always easy to enable. I will continue to investigate and see how we can address the issue. Duplicates: dotnet/runtime#93177 Visual Studio Community Issue |
After talking this over with more people on our team, the expectation is that binding redirects are required in order to use .NET standard packages in .NET framework projects. |
Library name and version
Azure.Core 1.35, Azure.Storage.Blobs 12.19 and 12.18
Describe the bug
When using an SDK package that transiently references
Azure.Core
1.35 in a .NET Framework project, an exception is thrown when code related toSystem.Diagnostics.DiagnosticSource
is executed. This includes creating aBlobServiceClient
fromAzure.Storage.Blobs
.This issue appears to stem from a mismatch between the dependency specified in the Azure.Core nuspec file and the assembly manifest.
The nuspec contains a reference to 6.0.1:
However, the Azure SDK libraries built for netstandard2.0 (e.g.
azure.core\1.35.0\lib\netstandard2.0\Azure.Core.dll
) contain a reference to 6.0.0:Expected behavior
I can use Azure SDK in .NET Framework without resorting to assembly binding redirects.
Actual behavior
An exception is thrown:
System.IO.FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Reproduction Steps
The code above throw this exception when using
Azure.Storage.Blobs
version 12.18 and 12.19 (latest), but works for version 12.17.Environment
The text was updated successfully, but these errors were encountered: