Bug #109670 Many MSB3246 errors when referencing MySql.Data 8.0.32

Submitted: 18 Jan 2023 6:37 Modified: 3 Mar 2023 19:45
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:8.0.32 OS:Windows (10, 11)
Assigned to: CPU Architecture:Other (x64)

[18 Jan 2023 6:37] Bradley Grainger
Description:
When compiling a program that references MySql.Data v8.0.32, dotnet build produces a lot of MSB3246 build warnings. This did not occur with v8.0.31.

The build warnings are:

❯ dotnet build
MSBuild version 17.4.1+9a89d02ff for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. System.BadImageFormatException: PE image does not have metadata. [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at System.Reflection.Metadata.MetadataReader.GetAssemblyName(String assemblyFile) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Shared.AssemblyNameExtension.GetAssemblyNameEx(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.SystemState.GetAssemblyName(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.ReferenceTable.SetPrimaryAssemblyReferenceItem(ITaskItem referenceAssemblyName) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. System.BadImageFormatException: PE image does not have metadata. [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at System.Reflection.Metadata.MetadataReader.GetAssemblyName(String assemblyFile) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Shared.AssemblyNameExtension.GetAssemblyNameEx(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.SystemState.GetAssemblyName(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.ReferenceTable.SetPrimaryAssemblyReferenceItem(ITaskItem referenceAssemblyName) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. System.BadImageFormatException: PE image does not have metadata. [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at System.Reflection.Metadata.MetadataReader.GetAssemblyName(String assemblyFile) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Shared.AssemblyNameExtension.GetAssemblyNameEx(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.SystemState.GetAssemblyName(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.ReferenceTable.SetPrimaryAssemblyReferenceItem(ITaskItem referenceAssemblyName) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. System.BadImageFormatException: PE image does not have metadata. [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at System.Reflection.Metadata.MetadataReader.GetAssemblyName(String assemblyFile) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Shared.AssemblyNameExtension.GetAssemblyNameEx(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.SystemState.GetAssemblyName(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.ReferenceTable.SetPrimaryAssemblyReferenceItem(ITaskItem referenceAssemblyName) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. System.BadImageFormatException: PE image does not have metadata. [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at System.Reflection.Metadata.MetadataReader.GetAssemblyName(String assemblyFile) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Shared.AssemblyNameExtension.GetAssemblyNameEx(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.SystemState.GetAssemblyName(String path) [C:\Code\MySql\Test\Test.csproj]
C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3246:    at Microsoft.Build.Tasks.ReferenceTable.SetPrimaryAssemblyReferenceItem(ITaskItem referenceAssemblyName) [C:\Code\MySql\Test\Test.csproj]
  Test -> C:\Code\MySql\Test\bin\Debug\net7.0\Test.dll

Build succeeded.

    5 Warning(s)
    0 Error(s)

How to repeat:
Install .NET SDK v7.0.102.
Run: dotnet new console
Run: dotnet add package MySql.Data
Run: dotnet build

Suggested fix:
Expected 0 warnings, 0 errors, as happened when using MySql.Data 8.0.31:

❯ dotnet build
MSBuild version 17.4.1+9a89d02ff for .NET
  Determining projects to restore...
  Restored C:\Code\MySql\Test\Test.csproj (in 291 ms).
  Test -> C:\Code\MySql\Test\bin\Debug\net7.0\Test.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)
[18 Jan 2023 7:30] MySQL Verification Team
Hello Bradley,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[30 Jan 2023 9:26] Rob Janssen
See https://bugs.mysql.com/bug.php?id=109716
[3 Mar 2023 19:45] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/NET 8.0.32.1 NuGet-only release, and here's the proposed changelog entry from the documentation team:

An Important Update 

The Connector/NET MySql.Data version 8.0.32.1 NuGet
package now is released and the newer package supersedes the original
8.0.32 package. All of the dotnet build warnings produced when compiling a
program that references MySql.Data version 8.0.32 (and related issues) are
resolved when referencing the MySql.Data 8.0.32.1 package.

Thank you for the bug report.
[7 Mar 2023 1:58] Brad Moore
@Christine Cole, I may be mistaken on what you meant by released, but I don't see that nuget package as released.

https://www.nuget.org/packages/MySql.Data/#versions-body-tab

As of today the latest version is 8.0.32, I don't see any 8.0.32.1 or 8.0.32.1 pre-release.

Can you confirm that I am looking at the right place and that it is indeed missing?

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.062 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.