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. Where do unhandled exceptions in event handlers go?

Where do unhandled exceptions in event handlers go?

Scheduled Pinned Locked Moved C#
debuggingquestion
2 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.
  • J Offline
    J Offline
    JoeRip
    wrote on last edited by
    #1

    When an exception in an event handler is not handled, where does it bubble up to? It's not bubbling up to anywhere in my Windows Form app. The exception itself gets reported in the debugger output, and the event handler terminates at the offending line of code, and my program runs happily along its way - no "unhandled exception" message is displayed anywhere. The code doesn't even stop when running hosted/in the debugger. If I wasn't watching the output window, I would have no idea the exception is being thrown. Is this expected? I can handle this, I guess, by carefully wrapping all the code in my event handler with Try/Catch. However, I wanted some exceptions to bubble up and be handled in my app - specifically, those *I* throw. But they go nowhere. And I'm realizing... where would they emerge, anyway?

    A 1 Reply Last reply
    0
    • J JoeRip

      When an exception in an event handler is not handled, where does it bubble up to? It's not bubbling up to anywhere in my Windows Form app. The exception itself gets reported in the debugger output, and the event handler terminates at the offending line of code, and my program runs happily along its way - no "unhandled exception" message is displayed anywhere. The code doesn't even stop when running hosted/in the debugger. If I wasn't watching the output window, I would have no idea the exception is being thrown. Is this expected? I can handle this, I guess, by carefully wrapping all the code in my event handler with Try/Catch. However, I wanted some exceptions to bubble up and be handled in my app - specifically, those *I* throw. But they go nowhere. And I'm realizing... where would they emerge, anyway?

      A Offline
      A Offline
      astanton1978
      wrote on last edited by
      #2

      I have had weirdness like this before when I attached the debugger to running code and there were PDB files from a different build (build and deploy on Monday, lose PDB files on Tuesday, add enough code [spaces] to change the file slightly, rebuild and try to attach to the process on Wednesday). The PDB are similar enough to allow the debugger to attach, but stepping through causes very odd behavior. Of course the solution for this is to either get the original PDB files, or rebuild the assembly and debug with the new ones. I have also seen cases where the output window shows a slew of "MissingMemberExceptions" or other system looking exceptions that happen in the background and doesnt appear to affect my program's execution. I assume these are thrown by dependant or underlying assemblies and handled down there, before they bubble up to the calling application. The output window may just be blindly dumping any exception data from the CLR. What kind of exception / details are in the window? Can you cut/paste that and a sample of the code that is executed right before and after the exception shows in the output window?

      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