如下代码,并未进入true流程
int iRet = 0;
if (iRet > 0)
{
string str = "sfasdfasdf";
str.Substring(0,3);
}而以下代码,却进入了true流程
int iRet = 0;
if (iRet > 0)
{
throw new Exception("XXXXXXX");
}
有谁碰到这种现象吗?
环境:WIN7 64bit,VS2008,项目是基于.Net FrameWork2.0的。
int iRet = 0;
if (iRet > 0)
{
string str = "sfasdfasdf";
str.Substring(0,3);
}而以下代码,却进入了true流程
int iRet = 0;
if (iRet > 0)
{
throw new Exception("XXXXXXX");
}
有谁碰到这种现象吗?
环境:WIN7 64bit,VS2008,项目是基于.Net FrameWork2.0的。
本以为可能是throw导致的问题,但是我写(0>0)就不会进true流程了
if (iRet > 0)
{
throw new Exception("ZZZZZZZZZZX");
}
try
{
string str = "asdfasdfasd";
str.Substring(0, 3);
}catch(Exception){
}
但是像下面这样就不会了:
int iRet = 0;
if (iRet > 0)
{
throw new Exception("ZZZZZZZZZZX");
}
//这里随便加两条语句
string str = "dsafasdf";
str.SubString(0,3);
try
{
string str = "asdfasdfasd";
str.Substring(0, 3);
}catch(Exception){
}
或者这样也不进 try
{
int iRet = 0;
if (iRet > 0)
{
throw new Exception("ZZZZZZZZZZX");
}
string str = "asdfasdfasd";
str.Substring(0, 3);
}catch(Exception){
}
原来throw 和try还有这样的影响关系,看来应该是编译器在编译的时候出的问题,具体原因不明。
以上问题在VS2008中测试出现,FW2.0,3.0,3.5均存在此问题。
另外还特意在VS2010里做了测试,无论选择哪个版本的FW均不会出现问题。注:由于没有测试条件,未在其他机子上测试。仅在本人机子上得出以上结论。
环境: WIN7 64bit 旗舰版 sp1
环境: WIN7 64bit 旗舰版 sp1
吗?
如果是的话,那就只能是我装什么插件影响到了