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. Global error handler

Global error handler

Scheduled Pinned Locked Moved C#
csharphtmlcomhelptutorial
11 Posts 5 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.
  • N Offline
    N Offline
    N a v a n e e t h
    wrote on last edited by
    #1

    Is there a way to log uncaught exceptions ? Something like an event which fires when an exception is uncaught. I am trying to exit my application gracefully after logging the exception occurred.

    All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

    G M F 3 Replies Last reply
    0
    • N N a v a n e e t h

      Is there a way to log uncaught exceptions ? Something like an event which fires when an exception is uncaught. I am trying to exit my application gracefully after logging the exception occurred.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      You need to handle this event: Application..::.ThreadException Event[^]

      Giorgi Dalakishvili #region signature my articles #endregion

      N 1 Reply Last reply
      0
      • N N a v a n e e t h

        Is there a way to log uncaught exceptions ? Something like an event which fires when an exception is uncaught. I am trying to exit my application gracefully after logging the exception occurred.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        M Offline
        M Offline
        MarkB777
        wrote on last edited by
        #3

        Well the exception is still detected somewhere, so there must be a way to log that error. Why not just design your program so that exceptions are handled? - A well designed program shouldn't be producing any unhandled exceptions. Mark.

        N B 2 Replies Last reply
        0
        • G Giorgi Dalakishvili

          You need to handle this event: Application..::.ThreadException Event[^]

          Giorgi Dalakishvili #region signature my articles #endregion

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          That's great. Thanks Giorgi. [edit] I am sorry I can't vote for you as CP is not allowing me to vote on messages. I am getting Forbidden message. [/edit]

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

          G 1 Reply Last reply
          0
          • N N a v a n e e t h

            Is there a way to log uncaught exceptions ? Something like an event which fires when an exception is uncaught. I am trying to exit my application gracefully after logging the exception occurred.

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

            F Offline
            F Offline
            fearless stallion
            wrote on last edited by
            #5

            Check this[^] Hope it helps

            kss

            N 1 Reply Last reply
            0
            • M MarkB777

              Well the exception is still detected somewhere, so there must be a way to log that error. Why not just design your program so that exceptions are handled? - A well designed program shouldn't be producing any unhandled exceptions. Mark.

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              MarkBrock wrote:

              A well designed program shouldn't be producing any unhandled exceptions.

              It might be correct. But since I don't know my user's system configurations and other settings, I need to make sure that all exceptions are passing through the handler which I defined.

              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

              1 Reply Last reply
              0
              • N N a v a n e e t h

                That's great. Thanks Giorgi. [edit] I am sorry I can't vote for you as CP is not allowing me to vote on messages. I am getting Forbidden message. [/edit]

                All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

                G Offline
                G Offline
                Giorgi Dalakishvili
                wrote on last edited by
                #7

                Glad to help you :)

                Giorgi Dalakishvili #region signature my articles #endregion

                1 Reply Last reply
                0
                • M MarkB777

                  Well the exception is still detected somewhere, so there must be a way to log that error. Why not just design your program so that exceptions are handled? - A well designed program shouldn't be producing any unhandled exceptions. Mark.

                  B Offline
                  B Offline
                  blakey404
                  wrote on last edited by
                  #8

                  :laugh: a wel produced program shouldnt produce any exceptions at all :laugh: but thats just not reality.

                  N 1 Reply Last reply
                  0
                  • F fearless stallion

                    Check this[^] Hope it helps

                    kss

                    N Offline
                    N Offline
                    N a v a n e e t h
                    wrote on last edited by
                    #9

                    fearless stallion wrote:

                    Hope it helps

                    Indeed :)

                    All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

                    1 Reply Last reply
                    0
                    • B blakey404

                      :laugh: a wel produced program shouldnt produce any exceptions at all :laugh: but thats just not reality.

                      N Offline
                      N Offline
                      N a v a n e e t h
                      wrote on last edited by
                      #10

                      blakey404 wrote:

                      but thats just not reality.

                      True. No one can handle all exceptions.

                      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

                      B 1 Reply Last reply
                      0
                      • N N a v a n e e t h

                        blakey404 wrote:

                        but thats just not reality.

                        True. No one can handle all exceptions.

                        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

                        B Offline
                        B Offline
                        blakey404
                        wrote on last edited by
                        #11

                        it would be nice though... and we can try dam hard to get the majority of them :sigh:

                        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