C
C#2y ago
_._xena_._

✅ 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
lycian
lycian2y ago
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.
_._xena_._
_._xena_._OP2y ago
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 above
lycian
lycian2y ago
I'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
_._xena_._
_._xena_._OP2y ago
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
ACiDCA7
ACiDCA72y ago
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
_._xena_._
_._xena_._OP2y ago
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
ACiDCA7
ACiDCA72y ago
try downgrading to 8.0.31 looks like a known bug https://bugs.mysql.com/bug.php?id=109716
_._xena_._
_._xena_._OP2y ago
does it work if i just change it to 31
_._xena_._
_._xena_._OP2y ago
or i break everything ? I'm new in these so i dont know much
ACiDCA7
ACiDCA72y ago
should.. but you have to rebuild
_._xena_._
_._xena_._OP2y ago
dotnet restore right ah yeah it fixed thank you so much
ACiDCA7
ACiDCA72y ago
np dont forget to /close
Want results from more Discord servers?
Add your server