grafana / grafana-opentelemetry-dotnet

Grafana's distribution of OpenTelemetry instrumentation for .NET
Apache License 2.0
30 stars 5 forks source link

Could not load file or assembly 'MySql.Data.OpenTelemetry' or one of its dependencies. Strong name signature could not be verified. #98

Open gregprior opened 3 months ago

gregprior commented 3 months ago

Bug Report

A list of Grafana and OpenTelemetry NuGet packages used, for example Grafana.OpenTelemetry 0.6.0-beta.1):

The .NET runtime version (e.g. net462, net48, netcoreapp3.1, net6.0 etc.). You can find this information in your *.csproj file):

Symptom

A clear and concise description of what the bug is.

My application does not use MySQL. Test solution does not have any other packages loaded. Cannot load required MySql.Data.OpenTelemetry package because the signature could not be verified.

What is the expected behavior?

What did you expect to see?

What is the actual behavior?

What did you see instead?

Could not load file or assembly 'MySql.Data.OpenTelemetry' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

Reproduce

Create a self-contained project using the template of your choice, apply the minimum required code to result in the issue you're observing.

Additional Context

`Server Error in '/' Application. Could not load file or assembly 'MySql.Data.OpenTelemetry' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'MySql.Data.OpenTelemetry' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data.OpenTelemetry' could not be loaded.

=== Pre-bind state information === LOG: DisplayName = MySql.Data.OpenTelemetry (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: MySql.Data.OpenTelemetry | Domain ID: 2 WRN: A partial bind occurs when only part of the assembly display name is provided. WRN: This might result in the binder loading an incorrect assembly. WRN: It is recommended to provide a fully specified textual identity for the assembly, WRN: that consists of the simple name, version, culture, and public key token. WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue. LOG: Appbase = file:///C:/Users/xyz/source/repos/TestGrafanaOpenTelemetry/TestGrafanaOpenTelemetry/ LOG: Initial PrivatePath = C:\Users\xyz\source\repos\TestGrafanaOpenTelemetry\TestGrafanaOpenTelemetry\bin Calling assembly : (Unknown).

LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Users\xyz\source\repos\TestGrafanaOpenTelemetry\TestGrafanaOpenTelemetry\web.config LOG: Using host configuration file: C:\Users\xyz\OneDrive - StoneEagle F&I\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/Users/xyz/AppData/Local/Temp/Temporary ASP.NET Files/vs/f70b5a77/80574c61/MySql.Data.OpenTelemetry.DLL. LOG: Attempting download of new URL file:///C:/Users/xyz/AppData/Local/Temp/Temporary ASP.NET Files/vs/f70b5a77/80574c61/MySql.Data.OpenTelemetry/MySql.Data.OpenTelemetry.DLL. LOG: Attempting download of new URL file:///C:/Users/xyz/source/repos/TestGrafanaOpenTelemetry/TestGrafanaOpenTelemetry/bin/MySql.Data.OpenTelemetry.DLL. LOG: Using application configuration file: C:\Users\xyz\source\repos\TestGrafanaOpenTelemetry\TestGrafanaOpenTelemetry\web.config LOG: Using host configuration file: C:\Users\xyz\OneDrive - StoneEagle F&I\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: MySql.Data.OpenTelemetry, Version=8.2.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d ERR: Failed to complete setup of assembly (hr = 0x80131045). Probing terminated.

Stack Trace:

[FileLoadException: Could not load file or assembly 'MySql.Data.OpenTelemetry' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]

[FileLoadException: Could not load file or assembly 'MySql.Data.OpenTelemetry, Version=8.2.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +37 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +159 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +80 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22 System.Reflection.Assembly.Load(String assemblyString) +29 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'MySql.Data.OpenTelemetry, Version=8.2.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +721 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +195 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +45 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +172 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +111 System.Web.Compilation.BuildManager.ExecutePreAppStart() +156 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +692

[HttpException (0x80004005): Could not load file or assembly 'MySql.Data.OpenTelemetry, Version=8.2.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +660 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189 ` Add any other context about the problem here.

matt-hensley commented 3 months ago

@gregprior I've been unable to reproduce this issue using the "ASP.NET Web Application (.NET Framework)" template in Visual Studio 2022. I selected the "Web API" option and have a minimal project where the application starts correctly.

Would you mind providing a sample project that shows this issue?

gregprior commented 3 months ago

My application is on .Net Framework using .Net 4.8.
Traces instrumentations states that MySql.Data is not supported on .NET Framework. @matt-hensley , here is the sample application that I created: TestGrafanaOpenTelemetry.zip

gregprior commented 3 months ago

@matt-hensley, I tried creating a new test package in VisualStudio 2022 and received the same error loading the MySql.Data.Opentelemetry package when trying to run it.

  1. I created a new solution using the "ASP.NET Web Application (.NET Framework)" template
  2. Selected "NET Framework 4.8.1"
  3. Created an empty project. The only thing I changed was unchecking the "Configure for HTTPS"
  4. Added the Grafana.OpenTelemetry.Base.0.8.1-beta NuGet package using the GUI
  5. Clicked the green triangle icon to run the project.