I have project with FiddlerApplication
that saves some sessions for me. When I start the program first launch after restart 100% fails and then 10% fails 90% works.
The biggest problem that when it fails it doesn't catch any exceptions in try/catch. Here is my code
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");
}
}
}
My new Updated Apconfigwith new error Configuration System Failed to Initialize
<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>
Some Exceptions are not getting caught by try..catch blocks unless you specify the attribute [HandleProcessCorruptedStateExceptions]
on the function (Main
function in your code). Of couse, the same could be accomplished by modifying the config file as Oxoron described.
Try to add
<runtime>
<legacyCorruptedStateExceptionsPolicy enabled="true" />
</runtime>
to the config file. Source here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With