timer causes crash with frame targeting web

  1.    26 Sep 2008 #1
    ormico Guest

    timer causes crash with frame targeting web

    I posted this at microsoft.public.dotnet.framework before I found the Avalog
    newsgroup, but I didn't get any helpful responses yet. If anyone has an idea
    what my problem might be, let me know what you think or what I might try.

    I have a small WPF application that has a frame that points to a web page on
    the internet.

    I also have a System.Timer.Timer that goes off after 1 minute. If I try to
    modify an object on the page it generates an error and crashes the program.
    This is an error that I cannot catch with a try catch block. It crashes the
    program anyway and prompts me to send the crash info to microsoft.

    What I am ultimatly try to accomplish is an application that displays a web
    page for a certain amount of time, then closes. I would like to put this in
    an appdomain that gets reloaded after it closes each time. This is because
    when the web page runs for a while in IE it will consume more and more
    memory. I want to be able to unload the page wit the web browser control to
    free the memory and then reopen and go back to the page. Most of this is
    working but I can't get the wpf page with the webbrowser control to close
    after a certain amount of time because when I call this.Close() or
    Application.Current.Shutdown() it crashes. I get the same behavior if I try
    to access any other controls also.

    The error I recieved, as stated in the original post, is the Windows Crash
    dialog that prompts you to send the error information to Microsoft. If you
    click "What does this error report containt?" you are presented with an Error
    Signature. The only part that looks useful is "P9 :

    Code Sample:
    Please note in the example below that I do not try do do anything with the
    exception except catch it.
    This is to be sure that I'm not introducing the exception in the catch block.

    class Startup
    static void Main()
    // AppDomain code commented out.
    //CrossAppDomainDelegate action = () =>
    // App app = new App();
    // app.MainWindow = new Window1();
    // app.MainWindow.Show();
    // app.Run();

    //for (int i = 0; i < 10; i++)
    // try
    // {
    // AppDomain domain = AppDomain.CreateDomain("another domain");
    // domain.DoCallBack(action);
    // }
    // catch (Exception ex)
    // {
    // }

    App app = new App();
    app.MainWindow = new Window1();
    catch (Exception)


    <Window x:Class="WpfWebBrowser.Window1"
    Title="Window1" Height="800" Width="1118" WindowState="Maximized">
    <Grid Name="grMain">
    <Frame Name="frmDisplay" NavigationUIVisibility="Visible"
    Margin="0,0,0,50" Source="http://example.com/" />
    <Button Name="btRefresh" Width="100" Height="32"
    Click="btRefresh_Click" HorizontalAlignment="Left" Margin="12,0,0,12"
    <Button Name="btClose" Width="100" Height="32" Click="btClose_Click"
    HorizontalAlignment="Left" Margin="118,0,0,12"

    public partial class Window1 : Window
    public Window1()

    timer2 = new System.Threading.Timer(timer2_Callback);
    timer2.Change((int)(TimeSpan.FromMinutes(1.0).TotalMilliseconds), 0);

    void timer2_Callback(object state)
    btRefresh.Content = "blah";
    catch (Exception)


    System.Threading.Timer timer2 = null;

    private void btRefresh_Click(object sender, RoutedEventArgs e)
    frmDisplay.Navigate(new Uri("http://example.com/"));

    private void btClose_Click(object sender, RoutedEventArgs e)

      My System SpecsSystem Spec

  2.    26 Sep 2008 #2
    ormico Guest

    RE: timer causes crash with frame targeting web

    I should add that clicking the Close button closes the window with no error.
      My System SpecsSystem Spec

timer causes crash with frame targeting web

Similar Threads
Thread Forum
What Version of Win 7 Are You Targeting?
I really feel like walking dead this week just out of surgery in chronic pain and I have absolutely no patience for Microsoft's ca-ca de toro that...
.NET General
Privacy Groups Urge Curbs on Online Targeting
A coalition of privacy groups wants Congress to force online marketing companies to get amnesia about what citizens do online, unless they get...
Chillout Room
First Timer
who is the email client? , and what service are you using? Most use Pop3 clients, and has to be configured for POP3 and SMTP.
Vista mail
Microsoft Confirms Attacks Targeting Critical 0-Day Office Excel Vulnerability
more: Softpedia
System Security
Multi - targeting not working properly.
Hello. I recently started a WPF project in .NET 3.5. Since then I learned that the target arhitecture does not support .NET 3.5, only .Net 3.0. I...
Egg Timer
The Egg Timer is back!
Vista General
Microsoft Launches Enforcement Campaign Targeting Web Site “Cybersquatters” Who Use Online Ads
Microsoft Launches Enforcement Campaign Targeting Web Site “Cybersquatters” Who Use Online Ads New lawsuits allege defendants illegally...
Vista News

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 09:25.