locked
VS2010 and WPF slow debug issues

    Вопрос

  • hi all,

    im (like a lot of other people) doing my first steps in vs2010.

    one of the things i just found which really annoys me is that each time i try to debug a WPF application the ide slows down so each movement from one statement to the other results in 10 sec. (!) waiting.

    what can i do ? is there a nice solution (besides not using WPF:)

    adiel.

    9 июня 2010 г. 12:23

Все ответы

  • I think I'm in the same boat, but I tried a very basic WPF 4 app in both Debug and Release Mode.

    Here is the XAML.  Grid is main panel in Window.

    <Grid>
        <StackPanel Margin="0">
          <ComboBox x:Name="cmbTest" />
          <Button x:Name="btnTest" 
              Click="btnTest_Click"
              Content="Test"/>
        </StackPanel>
      </Grid>

    Here is the code for button click.

    List<string> lstStrings = new List<string>();
          lstStrings.Add("asdf");
          lstStrings.Add("fdfdfd");
          lstStrings.Add("rereree");
          lstStrings.Add("bvbv");
          lstStrings.Add("jhjhjhjh");
          lstStrings.Add("oioioioio");
          lstStrings.Add("vvcvcvcvc");
          lstStrings.Add("rererwerew");
          lstStrings.Add("mnmnmnmn");
          lstStrings.Add("ar rasraser es");
    
          cmbTest.ItemsSource = lstStrings;

    After I click the button and then click the dropdown, it is VERY slow to respond.  It takes several seconds to display the data.

    I saw this same thing in another app before trying this one.  It would eventually throw a ContextSwitchDeadlock exception.  I came across a blog that says to disable, but did not help.

    Any help is appreciated.  Thanks in advance.

    9 июня 2010 г. 13:41
  • UPDATE:  It appears my WPF app ( and test app ) are slow when only debugging.  If I run without debug ( Ctrl+F5 ) it appears to be faster when I click the ComboBox dropdown. 

    Is there something I can do to speed up in debug mode?

    Thanks again.

    9 июня 2010 г. 14:03
  • Hello re-raising the question ?

    haven't got an answer yet ...

    can someone help ?

    24 июня 2010 г. 8:45
  • How much slower is the app in Debug mode compared to Release?

    Some slowdown is to be expected in Debug mode because of the combination of instrumentation and debug builds not using certain optimizations.

    Can you give rough timings for an action in the two modes?

    Mark


    Mark Wilson-Thomas - Program Team - WPF & SL Designer for Visual Studio - posts are provided 'as-is'
    24 июня 2010 г. 20:20
  • It seems quite fast and as expected during Release mode... Click the dropdown and reacts almost instant.  In Debug mode, it seems like it takes 20 - 30 seconds.  Have not seen this in VS 2008 before.  I was able to duplicate on create a couple WPF example apps ( just a ComboBox and Button ), added a few strings and ran the app.  The XAML was attached in previous post above.  It also seems to lockup ( can't duplicate this ) when clicking to open the calendar on the DatePicker control. 

    Not sure if this matters, but my machine is a new 64-bit DELL with VS 2010 and Blend 4.  No previous versions were installed on this machine.

    Thanks again for reply. 

    25 июня 2010 г. 1:23
  • Well, my application seems to run quite the same in both modes till i stop at a breakpoint to debug it.

    then each movement from one code line to the other takes around 10-20 sec. !

    quite annoying and it happends on every without any connection to its complexity.

    thanks.

    27 июня 2010 г. 4:36
  • Thanks @shaggygi and @Medinol for your information.

    @Medinol, you mention that "it happens on every without any connection to its complexity" - do you mean by that that you see slowdowns even with trivial applications (e.g if you create a new WPF app, add some simple code like an event handler, and try debugging as you did with your real-world apps)? If not, it would be useful to work with you to take a look at your real applications if possible.  Same question for @shaggygi.

     

    Thanks

    Mark


    Mark Wilson-Thomas - Program Team - WPF & SL Designer for Visual Studio - posts are provided 'as-is'
    28 июня 2010 г. 16:09
  • I am also in the same boat for a very simple WPF browser application but mine takes up to 2 minutes to actually come up while using (F5)Debug   It even temporarily makes Visual Studio stop responding, it eventually does revert back to running eventually and then will finally load with or without breakpoints.  I did notice that all of this extra processing happens before InitializeComponent(); is even hit.  Any ideas?

    Running Xeon Quad core with 4GB Ram

    Windows Server 2003

    1 июля 2010 г. 12:40
  • @dbedo

    1. Do you see the same slow behavior for a brand-new WPF browser app run under debug mode (i.e. just create using File...New, don't add anything to the app and F5 it)?

    2. If you Ctrl-F5 (run without debug), is the delay still evident?

    Mark


    Mark Wilson-Thomas - Program Team - WPF & SL Designer for Visual Studio - posts are provided 'as-is'
    1 июля 2010 г. 17:38
  • Ran ok for about a week(vb 2010 express) now starting in debug can take up to 10 minutes(CPU load >50%) to react, once the appl. is running it's ok, stopping the program takes another 5-10 minutes, so vs 2010 which I was testing is completly useless, or has anyone an idea what's causing it, I read in this forum that "@dbedo" has the same problem, NO SOLUTION ???( BTW when I was changing an option in the debug-menu the same thing happened)

     

    Wil

    21 октября 2010 г. 21:19
  • The "slowdown" appears only when debugging (F5). The performance without debugging (Ctrl F5) is quite acceptable. The problem seems to occur when WPF actually needs to draw something. In the application I am running all application code has finished and then there is a delay of about 30 seconds before the output appears on the screen. I will concede I am doing a lot of work (producing grid lines in the ListView).

     

    JC

     


    John Carroll
    • Предложено в качестве ответа ChillyWilly 8 марта 2011 г. 19:13
    • Отменено предложение в качестве ответа ChillyWilly 8 марта 2011 г. 19:13
    7 марта 2011 г. 13:39
  • After i decided that this slow behaviour was not acceptable and i would quit the 2010 version, i've tried one other thing: i copied all my programlines etc into new files into a new project and it all was ok, no delays noticed since.

     

     

    Wil

    • Предложено в качестве ответа Sergey V 26 февраля 2012 г. 19:38
    • Отменено предложение в качестве ответа Sergey V 26 февраля 2012 г. 19:38
    8 марта 2011 г. 19:18
  • This problem probably related to loading assemblies in VS

    Try to add

    public partial class App : Application
        {
            public static long Ticks;

            protected override void OnStartup(StartupEventArgs e)
            {
                Ticks = Environment.TickCount;

                Trace.WriteLine("Started at: " + Ticks); ...

    then add following code to your main WPF page

    void Window_Loaded(object sender, RoutedEventArgs e)
            {
                Trace.WriteLine("Loaded at: " + Environment.TickCount);

    For me it render 11 sec delay on i7-820QM + SSD x25M 80GB. In debug output you'll see few DLLs loaded. Loading PresentationFramework library took most of the time.

    You can decrease amount of time taking to load assemblies by enabling "Visual Studio hosting process" in "Debug" tab within project properties.

    After enabling this option it render only 3 seconds to load in debug mode. (Exactly like CTRL+F5, but still much more than execute outside VS environment - 0.4 sec)

    • Предложено в качестве ответа Sergey V 26 февраля 2012 г. 21:14
    26 февраля 2012 г. 19:49