I used open source program in part of my project, implant code in my project well and it worked good. but i'm new in programming and sorry to say this: i did not remember what did i do to this project.i tried to configure project, and change platform to x86
and x64
and AnyCPU
then i build my solution and have some error about target CPU, so i change every thing(im not sure!) to default. Then i build solution and get this error when i wanted to execute open-source section of my program :
Exception has been thrown by the target of an invocation. An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
I test this part of my project in open-source project. but there was not no error. every thing are same but my project thrown an error.
if this help to help me: It is part of my program that thrown error and open-source program without no problem!
ArrayList pluginsKeeper = new ArrayList();
StreamReader pluginReader = new StreamReader("Agent.dm");
string line;
char[] separator = { ' ', '\t', '\n' };
string[] tokens;
while ((line = pluginReader.ReadLine()) != null)
{
line = line.Trim();
if (line.Length > 0 && line[0] != ';')
{
tokens = line.Split(separator);
if (tokens[0].Equals("Agent1Default"))
{
defaultChecked = int.Parse(tokens[1]);
}
else
{
System.Runtime.Remoting.ObjectHandle oh = Activator.CreateInstanceFrom(tokens[0], tokens[1]);
pluginsKeeper.Add(oh.Unwrap());
}
}
}
pluginReader.Close();
its thrown error here: System.Runtime.Remoting.ObjectHandle oh = Activator.CreateInstanceFrom(tokens[0], tokens[1]);
.
this problem has strange answer! When windows wants to save file in windows for later you, it used '/' instead of '.'. So my program couldn't read the file!
I hope this help someone.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.