抛出了System.BadImageFormatException。 [英] System.BadImageFormatException was thrown.

查看:96
本文介绍了抛出了System.BadImageFormatException。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  private   void  captureButton_Click(对象发​​件人,EventArgs e)
{
#region如果未创建捕获,请立即创建
if (_capture == null
{
< span class =code-keyword> try
{
_capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
#endregion

if (_capture!= null
{
if (_captureInProgress)
{ // 停止捕获
captureButton.Text = 启动捕获;
Application.Idle - = ProcessFrame;
}
其他
{
// < span class =code-comment>开始捕获
captureButton.Text = 停止;
Application.Idle + = ProcessFrame;
}

_captureInProgress =!_captureInProgress;
}
}





当我点击captureButton_Click时,它抛出了一个未处理的异常,如下所示:

尝试加载格式不正确的程序。 (System.BadImageFormatException)抛出了System.BadImageFormatException。尝试加载格式不正确的程序。 (HRESULT的例外情况:0x8007000B)



有谁能请帮帮我吗?我是新手。谢谢。

我正在使用带有64位的VS 2010,emgu库。

解决方案

通常这与64位的差异有关32位DLL构建和处理。



尝试通过更改项目属性/构建/平台目标来编译为32位。

private void captureButton_Click(object sender, EventArgs e)
        {
            #region if capture is not created, create it now
            if (_capture == null)
            {
                try
                {
                    _capture = new Capture();
                }
                catch (NullReferenceException excpt)
                {
                    MessageBox.Show(excpt.Message);
                }
            }
            #endregion

            if (_capture != null)
            {
                if (_captureInProgress)
                {  //stop the capture
                    captureButton.Text = "Start Capture";
                    Application.Idle -= ProcessFrame;
                }
                else
                {
                    //start the capture
                    captureButton.Text = "Stop";
                    Application.Idle += ProcessFrame;
                }

                _captureInProgress = !_captureInProgress;
            }
        }



When I click on captureButton_Click,it threw an unhandled exception like below:
An attempt was made to load a program with an incorrect format. (System.BadImageFormatException)A System.BadImageFormatException was thrown. An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Can anyone please help me out? I'm new to it. Thanks.
I'm using VS 2010 with 64 bits, emgu library.

解决方案

Usually this is related to the difference in 64bit and 32bit DLL builds and processes.

Try compiling to 32bit by changing project properties/Build/Platform Target.


这篇关于抛出了System.BadImageFormatException。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆