Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. What could cause a Dispatcher Thread to terminate abnormally?

What could cause a Dispatcher Thread to terminate abnormally?

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studiowpfdesign
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    carbon_golem
    wrote on last edited by
    #1

    We have several embedded resources file in XML format that can be loaded at runtime. The UI is a WPF application. When these files area loaded, it constructs objects via the XmlSerializer, and those resulting objects are used to make little boxes float around a 3D window for a simulation. At some point when adding, the application appears to hang. Alright... That's happened to me a-plenty, but it throws absolutely no exception and I don't get the "Not Responding" notification. Another interesting observation is that after the hang, when the mouse is put over the app window, the control boxes flash like a rapid hover-over. When I break into the debugger (btw I have the IDE to break on all thrown exceptions) I can see where the app stops, but no data is available because the IDE reports that the executing thread is in a sleep or join state. I guess the question is how can I detect when the Dispatcher Thread takes a dirt nap? Is there a way to appoint a new thread to watch it and restart? Scott

    "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

    C R 2 Replies Last reply
    0
    • C carbon_golem

      We have several embedded resources file in XML format that can be loaded at runtime. The UI is a WPF application. When these files area loaded, it constructs objects via the XmlSerializer, and those resulting objects are used to make little boxes float around a 3D window for a simulation. At some point when adding, the application appears to hang. Alright... That's happened to me a-plenty, but it throws absolutely no exception and I don't get the "Not Responding" notification. Another interesting observation is that after the hang, when the mouse is put over the app window, the control boxes flash like a rapid hover-over. When I break into the debugger (btw I have the IDE to break on all thrown exceptions) I can see where the app stops, but no data is available because the IDE reports that the executing thread is in a sleep or join state. I guess the question is how can I detect when the Dispatcher Thread takes a dirt nap? Is there a way to appoint a new thread to watch it and restart? Scott

      "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

      C Offline
      C Offline
      carbon_golem
      wrote on last edited by
      #2

      After dealing with this for two days, we found the issue. The coordinates for the floating boxes are calculated with respect to time in a wrapped timer. We changed the internal timer of that class to be a DispatchTimer and now everything seems fine... Thanks to those that took the time to read this.

      "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

      1 Reply Last reply
      0
      • C carbon_golem

        We have several embedded resources file in XML format that can be loaded at runtime. The UI is a WPF application. When these files area loaded, it constructs objects via the XmlSerializer, and those resulting objects are used to make little boxes float around a 3D window for a simulation. At some point when adding, the application appears to hang. Alright... That's happened to me a-plenty, but it throws absolutely no exception and I don't get the "Not Responding" notification. Another interesting observation is that after the hang, when the mouse is put over the app window, the control boxes flash like a rapid hover-over. When I break into the debugger (btw I have the IDE to break on all thrown exceptions) I can see where the app stops, but no data is available because the IDE reports that the executing thread is in a sleep or join state. I guess the question is how can I detect when the Dispatcher Thread takes a dirt nap? Is there a way to appoint a new thread to watch it and restart? Scott

        "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

        R Offline
        R Offline
        Roger Alsing 0
        wrote on last edited by
        #3

        Just out of curiosity. how does WPF deal with gui elements and threads? is it the same as winforms idea? "only the main thread should interact with gui elements, other threads have to marshal calls to the main thread" or can threads create / interact with wpf elements freely?

        Blog: http://www.rogeralsing.com Projects: http://www.puzzleframework.com

        C 1 Reply Last reply
        0
        • R Roger Alsing 0

          Just out of curiosity. how does WPF deal with gui elements and threads? is it the same as winforms idea? "only the main thread should interact with gui elements, other threads have to marshal calls to the main thread" or can threads create / interact with wpf elements freely?

          Blog: http://www.rogeralsing.com Projects: http://www.puzzleframework.com

          C Offline
          C Offline
          carbon_golem
          wrote on last edited by
          #4

          From what I've read, WPF assigns 2 threads at the start, a Render thread and a Dispatcher thread. The Render thread does the background work, while the Dispatcher thread does the work of maintain the GUI. Any explanation I give you won't be as good as this on MSDN[^] Scott

          "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups