如何处理这个异常。 [英] how to handle this exception.

查看:157
本文介绍了如何处理这个异常。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Visual Studio 2010上运行C#中的一个小应用程序,从视频中提取帧。

当我尝试构建解决方案时,它给了我以下警告:



项目的处理器架构之间存在不匹配正在构建MSIL和参考MWArray,版本= 2.12.0.0,culture = neural,publicKeyToken = e1d84a0da19db86f,processorArchitecture = AMD64,x86的处理器架构。这种不匹配可能会导致运行时故障。请考虑通过配置管理器更改项目的目标处理器体系结构,以便在项目和引用之间调整处理器体系结构,或者使用与项目的目标处理器体系结构相匹配的处理器体系结构依赖于引用。 />


现在我试图将项目配置更改为x86。现在警告已经消失。



i尝试过开始调试程序会出错。



TypeInitializationException未处理。



//// //代码//////////////////////



使用系统;



使用System.Collections.Generic;



使用System.ComponentModel;



使用System.Data;



使用System.Drawing;



使用System.Linq ;



使用System.Text;



使用System.Wi使用MathWorks.MATLAB.NET.Arrays;



使用MathWorks.MATLAB.NET.Utility;



名称空间检查



{

公共部分类Form1:表格



{



finalNative.edit mtb = new finalNative.edit(); ////////////// ...>> 这里是错误信息



静态对象Val;



public Form1()



{



InitializeComponent();

}



private void button1_Click(object sender,EventArgs e)



{



OpenFileDialog fdlg = new OpenFileDialog();



fdlg.Title =选择文件;



fdlg.Filter =所有文件(*。*)| *。* |所有文件(* .avi)| * .avi;



fdlg.FilterIndex = 2;



fdlg.RestoreDirectory = true;



fdlg.ShowDialog();



if(fdlg。 FileName!= string.Empty)



{



textBox1.Text = fdlg.FileName;



}



其他



textBox1。 Text =请在提交表单前选择.avi文件!;



Val = textBox1.Text;



}



private void button2_Click(对象发送者,EventArgs e)



{

if(textBox1.Text!= String.Empty)

{

mtb.frames(textBox1.Text);

makeframe.Enabled = false;

label2.Enabled = false;

MessageBox.Show(视频转换为帧!);



}



}



private void button3_Click(object sender,EventArgs e)

{

mtb.formating(textBox1。文字);

MessageBox.Show(框架颜色应该更改和保存!);

formating.Enabled = false;

label3 .Enabled = false;



}



private void makevideo_Click(object发件人,EventArgs e)

{

mtb.makevideo(textBox1.Text);

MessageBox.Show(视频创建完成并保存名称+结果video.avi);

makevideo.Enabled = false;

label4.Enabled = false;







}



private void exit_Click(object sender,EventArgs e)

{





this.Close();



}



private void textBox1_TextChanged(object sender,EventArgs e)

{



}



private void label1_Click(object sender,EventArgs e)

{

< br $>
}



private void button1_Click_1(对象发件人,EventArgs e)

{





}



private void Form1_Load(object sender,EventArgs e)

{



}





}

}







请告诉我如何处理这个异常。

I am trying to run a small application in C# on visual studio 2010 that extracts frames from a video.
When I tried to build the solution it gave me the following warning:

"There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "MWArray , version =2.12.0.0 , culture=neural , publicKeyToken=e1d84a0da19db86f, processorArchitecture=AMD64 , "x86" . this mismatch may cause runtime failures. please consider changing the targeted processor architecture of your project through the configuration manager so as to align the processor architecture between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project."

right now i tried to change the project configuration to x86. now the warning is now disappeared.

i tried to start debug the program is gives an error .

TypeInitializationException was unhandled.

////// code//////////////////////

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using finalNative;

using MathWorks.MATLAB.NET.Arrays;

using MathWorks.MATLAB.NET.Utility;

namespace check

{
public partial class Form1 : Form

{

finalNative.edit mtb = new finalNative.edit(); ////////////// ... >>here is the error message

static object Val;

public Form1()

{

InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)

{

OpenFileDialog fdlg = new OpenFileDialog();

fdlg.Title = "Select File ";

fdlg.Filter = "All files (*.*)|*.*|All files (*.avi)|*.avi";

fdlg.FilterIndex = 2;

fdlg.RestoreDirectory = true;

fdlg.ShowDialog();

if (fdlg.FileName != string.Empty)

{

textBox1.Text = fdlg.FileName;

}

else

textBox1.Text = "Please Select .avi file before submit the form ! ";

Val = textBox1.Text;

}

private void button2_Click(object sender, EventArgs e)

{
if (textBox1.Text != String.Empty)
{
mtb.frames(textBox1.Text);
makeframe.Enabled = false;
label2.Enabled = false;
MessageBox.Show("Video Converted into Frames!");

}

}

private void button3_Click(object sender, EventArgs e)
{
mtb.formating(textBox1.Text);
MessageBox.Show("Frames Color Should be changed and Saved !");
formating.Enabled = false;
label3.Enabled = false;

}

private void makevideo_Click(object sender, EventArgs e)
{
mtb.makevideo(textBox1.Text);
MessageBox.Show("Video Creation complete And Saved with Name "+"resultant video.avi");
makevideo.Enabled = false;
label4.Enabled = false;



}

private void exit_Click(object sender, EventArgs e)
{


this.Close();

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void label1_Click(object sender, EventArgs e)
{

}

private void button1_Click_1(object sender, EventArgs e)
{


}

private void Form1_Load(object sender, EventArgs e)
{

}


}
}



please tell me how to handle this exception.

推荐答案

你有MWArray.dll的版本是为AMD64处理器构建的,而您当前的项目配置为MSIL(独立于处理器)。您不能在项目中使用这样的dll(特定于处理器)(独立于处理器)......

您有两种选择:

1.获取MWArray的MSIL版本.dll

2.为AMD64构建项目
The version of MWArray.dll you have is built fro AMD64 processors, while your current project is configured to MSIL (processor independent). You can not use such a dll (processor specific) from your project (processor independent)...
You have two options:
1. Get a MSIL version of MWArray.dll
2. Build your project for AMD64


这篇关于如何处理这个异常。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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