G
Guest
hi ,
The Code like this:
public static Mapping Deserialize(string strXmlFilePath)
{
XmlSerializer s = new XmlSerializer(typeof(Mapping));
using (StreamReader sr = new StreamReader(strXmlFilePath))
{
object o = s.Deserialize(sr);
Mapping m = (Mapping)o;
return m;
}
}
Sometimes ,it will throw an InvalidCastException.
The strXmlFilePath refer to a same file ,but sometimes it works well
,sometimes it throws a exception.
I can't catch this exception in a debuger,because it always works well in
the debuger.
Anyone know what's wrong?
thanks
The Code like this:
public static Mapping Deserialize(string strXmlFilePath)
{
XmlSerializer s = new XmlSerializer(typeof(Mapping));
using (StreamReader sr = new StreamReader(strXmlFilePath))
{
object o = s.Deserialize(sr);
Mapping m = (Mapping)o;
return m;
}
}
Sometimes ,it will throw an InvalidCastException.
The strXmlFilePath refer to a same file ,but sometimes it works well
,sometimes it throws a exception.
I can't catch this exception in a debuger,because it always works well in
the debuger.
Anyone know what's wrong?
thanks