我有一个使用FiddlerApplication
保存一些会话的项目。当我在重新启动后首次启动程序时,100%失败,然后10%失败,90%正常工作。
最大的问题是,在try/catch中它没有捕获到任何异常,这是我的代码:
static class Program
{
[STAThread]
static void Main(string[] args)
{
try
{
browserToRun.GoTo("www.test.com");
FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete;
//HERE it fails
FiddlerApplication.Startup(8888, true, true, true);
FiddlerApplication.Shutdown();
}
catch (Exception ex)
{
// it is not getting to here
FiddlerApplication.AfterSessionComplete -= FiddlerApplication_AfterSessionComplete;
FiddlerApplication.Shutdown();
}
}
public static void FiddlerApplication_AfterSessionComplete(Session sess)
{
try
{
if (!sess.fullUrl.Contains("test"))
return;
GlobalDownloadLink = sess.fullUrl;
}
catch (Exception ex)
{
successful = false;
throw new System.ArgumentException(ex.Message, "FiddlerApplication_AfterSessionComplete");
}
}
}
我的新更新的Apconfig出现了新的错误,配置系统初始化失败。
<configuration>
<runtime>
<legacyCorruptedStateExceptionsPolicy enabled="true" />
</runtime>
<configSections>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
<appSettings>
<add key="BrowserShow" value="Y"/>
<add key="DebugCreate" value="true"/>
<add key="FileName10" value="AccountActivity"/>
<add key="FileName20" value="ForeignActivities"/>
<add key="FileNameShar" value="MatbeotSchirim"/>
</appSettings>
</configuration>
NullReferenceException e
),那么它将永远无法被处理。 - BenGlobalDownloadLink = sess.fullUrl;
。这是在你的return;
之后,你确定这样做是正确的吗? - Ben