What does BadImageFormatException 0x80131124 (Index not found) mean?

一笑奈何 提交于 2019-12-23 17:23:26

问题


My program is occasionally crashing with the following error message:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124)

Some details which may be relevant:

  • C# 4 / .NET 4
  • Windows 7 64 bit OS. EXE is for Any CPU (so it's in 64 bit mode).
  • This is thrown during construction of one of my custom objects. I'm creating this object in a child AppDomain so that I can unload the DLLs which it will load by servicing the incoming request.
  • I see from http://blogs.msdn.com/b/yizhang/ that HRESULT 0x80131124 = CLDB_E_INDEX_NOTFOUND.
  • I've only seen this happen recently (been working on this app for 3 years), and even now, it only occurs when I try profiling the tool using the Red Gate Performance Analyzer or Red Gate Memory Analyzer.

My questions are

  • What does this mean ?
  • What is the 'Index Not Found' ?
  • How do I fix this ?

Thanks very much.

UPDATE

Instead of targeting the EXE for ANY, I forced it to x64. The problem still occurs.


回答1:


Have a look in your solution configuration to make sure all your projects build to the same platform.

The reason for your error is because you have a x86 file trying to load a 64bit dll or Vice versa.

Hope it helps.




回答2:


You can change your platform target build to X86



来源:https://stackoverflow.com/questions/8251606/what-does-badimageformatexception-0x80131124-index-not-found-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!