Build fails with "BadImageFormatException: Format of the executable or library is invalid" error

I just found out that I cannot build my project any more, as it fails with the following stacktrace everytime I try:

mageReader.ReadImage () (at <0d95379e98c341408123992462669946>:0)
Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) (at <0d95379e98c341408123992462669946>:0)
Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) (at <0d95379e98c341408123992462669946>:0)
Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) (at <0d95379e98c341408123992462669946>:0)
Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) (at <0d95379e98c341408123992462669946>:0)
Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName) (at <0d95379e98c341408123992462669946>:0)
UnityEditor.AssemblyHelper.ExtractInternalAssemblyName (System.String path) (at /home/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:65)
UnityEditor.AssemblyHelper.CheckForAssemblyFileNameMismatch (System.String assemblyPath) (at /home/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:20)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

I suspect it might have something to do with Optional library which I added to the project as dll dependency, but it works correctly in play mode and I double checked that it’s really a managed dll. I even tried different versions of the dll without avail.

At least, it would be helpful to track down the cause if there’s some way to find out what file is causing the problem. I tried to perform text search ‘0d95379e98c341408123992462669946’ which I assumed to be a global ID for the asset, but I didn’t get any result.

Could anyone help me in fixing, or at least tracking down this problem?

Thanks!

Anyone, please?

Sorry for the bumping. But I’m stuck with this problem so I’d appreciate any kind of feedback.

I have the same problem today, hope somebody can help!

I sent a bug report, and the issue was confirmed and sent to the developers for further investigation. I hope they’ll come up with a fix soon.

1 Like

Yeah, that a good news!:wink:

Now I found the reason of my editor error: I opened the project from a usb driver.
When I copy the project to the hard disk, the error is gone.

Thank for the information. Though it seems we have different problems from each other, since my project isn’t on any removable device.