Search code examples
c#azureazure-blob-storagesystem.diagnostics

System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51


I'm encountering a problem, but with a more recent version. I receive an error stating "System.Diagnostics.DiagnosticSource, Version=6.0.0.0," although Azure.Core utilizes version 6.0.0.1.

When I downgrade my NuGet package from 6.0.0.1 to 6.0.0.0, I encounter a different error: "Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'."

Attempting to switch from version 6.0.0.0 to 4.0.4.0 results in a compatibility issue with "Azure.Core" and "Azure.Storage.Blobs," which do not support System.Diagnostics.DiagnosticSource, Version=4.0.4.0. Despite having consistent references to version 6.0.0.1 in both my web.config and the app.config of my new DLL, the error persists.

<dependentAssembly>
        <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
</dependentAssembly>

LOGS:

=== Pre-bind state information === LOG: DisplayName = System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (Fully-specified) LOG: Appbase = file:///D:/System/testsystem/ LOG: Initial PrivatePath = D:\System\testsystem\bin Calling assembly : Azure.Storage.Blobs, Version=12.19.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8.
LOG: This bind starts in default load context. LOG: Using application configuration file: D:\System\testsystem\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Post-policy reference: System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/4a4892e4/1a9eb44/System.Diagnostics.DiagnosticSource.DLL. WRN: Comparing the assembly name resulted in the mismatch: Revision Number ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. DATE/TIME: 11/21/2023 10:53:57 PM

I have upgrade and downgrade packages.


Solution

  • I discovered the solution: The issue was that the <dependentAssembly> tags in the web.config were not being recognized, preventing the new dll from functioning correctly. This was due to the <configuration> tag containing namespace attributes, which resulted in the <assemblyBinding> tag being overlooked.

    Incorrect configuration: <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

    Correct configuration: <configuration>

    After correcting this, the assembly classes were read properly, allowing me to direct the system to the correct dlls.