✅ warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible.
I'm doing some codes in visual code and I don't what's wrong exactly. So the thing is I did a localhost connection from visual code using nuget and .net framework. So basically what I'm doing right now is trying to connect MySql database successfully first. It actually connects successfully but giving me this yellow error with it above
warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. PE image does not have metadata. PE image does not have metadata. I don't know is it important or how to solve it so can anybody help ?
12 Replies
I assume you're hitting this at runtime? That indicates some DLL (which I believe is likely to be native) is incompatible
Likely it's throwing https://learn.microsoft.com/en-us/dotnet/api/system.badimageformatexception?redirectedfrom=MSDN&view=netframework-4.7.2
BadImageFormatException Class (System)
The exception that is thrown when the file image of a dynamic link library (DLL) or an executable program is invalid.
yeah, when i type dotnet run it gives me this warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. PE image does not have metadata. PE image does not have metadata.
and then runs the code but code runs successfully because I don't get exception when i do try catch i get my own
Console.WriteLine("Connection succeed")
code which means code runs as it should but I get those warnings aboveI'm not very familiar with the MySQL database connectors, but my guess is whatever package you're using has native implementations and some of it is failing. It may succeed gracefully with this failure
whoever owns the package would likely know more
I see. I saw some entries on the internet they were saying this is about native DLLs but I couldn't find any solution. Hope someone who knows help. Thank you though
to find a solution it would be nice to know which nuget you actually referenced..
you are saying you are using net framework but which version?
32bit app or 64bit
PE indicates a native app/lib so might have to use the correct one
net 7.0 64 bit
i dont understand what do you mean by which nuget referanced but if you're asking package referance it's MySql.Data version: 8.0.32
try downgrading to 8.0.31
looks like a known bug https://bugs.mysql.com/bug.php?id=109716
does it work if i just change it to 31
or i break everything ? I'm new in these so i dont know much
should.. but you have to rebuild
dotnet restore right
ah yeah it fixed
thank you so much
np
dont forget to /close