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. Mysterious error dialog on exit....

Mysterious error dialog on exit....

Scheduled Pinned Locked Moved C#
debugginghelpcsharpcomtutorial
10 Posts 6 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
    CherezZaboro
    wrote on last edited by
    #1

    I'm getting very often but not always some kind of error dialog when I quit my app in C# that uses some COM objects. Unfortunately I can't tell what it is because when it pops up the application closes in like 10th of a seccond and I can't see what's the dialog about. This is release build. Debug doesn't report anything in debugger on exit ever. I understand it's very vague but I still need help and hope someone here can help me. How to catch the error? Thanks a lot for help in advance!

    M T G C A 5 Replies Last reply
    0
    • C CherezZaboro

      I'm getting very often but not always some kind of error dialog when I quit my app in C# that uses some COM objects. Unfortunately I can't tell what it is because when it pops up the application closes in like 10th of a seccond and I can't see what's the dialog about. This is release build. Debug doesn't report anything in debugger on exit ever. I understand it's very vague but I still need help and hope someone here can help me. How to catch the error? Thanks a lot for help in advance!

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Hi! Have you tried catching a ThreadException in your main thread? Could be worth a try... Regards, mav -- Black holes are the places where god divided by 0...

      C 1 Reply Last reply
      0
      • C CherezZaboro

        I'm getting very often but not always some kind of error dialog when I quit my app in C# that uses some COM objects. Unfortunately I can't tell what it is because when it pops up the application closes in like 10th of a seccond and I can't see what's the dialog about. This is release build. Debug doesn't report anything in debugger on exit ever. I understand it's very vague but I still need help and hope someone here can help me. How to catch the error? Thanks a lot for help in advance!

        T Offline
        T Offline
        Tom Larsen
        wrote on last edited by
        #3

        It is possible to set a break point at the bottom of your main on Closing for the main form. Or if worse comes to worse, create a temporary button that behaves like "Quit" with your break point there.

        C 1 Reply Last reply
        0
        • C CherezZaboro

          I'm getting very often but not always some kind of error dialog when I quit my app in C# that uses some COM objects. Unfortunately I can't tell what it is because when it pops up the application closes in like 10th of a seccond and I can't see what's the dialog about. This is release build. Debug doesn't report anything in debugger on exit ever. I understand it's very vague but I still need help and hope someone here can help me. How to catch the error? Thanks a lot for help in advance!

          G Offline
          G Offline
          Graham Nimbley
          wrote on last edited by
          #4

          Try catching the exception raised by Application.Run() in a try catch block or handle the Application.ThreadException event. Graham

          1 Reply Last reply
          0
          • C CherezZaboro

            I'm getting very often but not always some kind of error dialog when I quit my app in C# that uses some COM objects. Unfortunately I can't tell what it is because when it pops up the application closes in like 10th of a seccond and I can't see what's the dialog about. This is release build. Debug doesn't report anything in debugger on exit ever. I understand it's very vague but I still need help and hope someone here can help me. How to catch the error? Thanks a lot for help in advance!

            C Offline
            C Offline
            cmaissan
            wrote on last edited by
            #5

            I too periodically see an error dialog flash when I quit my application. It seems to have started after I overrode WndProc to perform some custom drawing in a List View control, and doesn't seem to occur with any consistency. My gut says the window handle is being disposed while some of the painting routines are using it, but in all honestly I don't know enough and shouldn't even speculate. If you find a way to "capture" what the error dialog says, let me know. Regards, Chris -- modified at 23:42 Monday 24th April, 2006

            A 1 Reply Last reply
            0
            • C cmaissan

              I too periodically see an error dialog flash when I quit my application. It seems to have started after I overrode WndProc to perform some custom drawing in a List View control, and doesn't seem to occur with any consistency. My gut says the window handle is being disposed while some of the painting routines are using it, but in all honestly I don't know enough and shouldn't even speculate. If you find a way to "capture" what the error dialog says, let me know. Regards, Chris -- modified at 23:42 Monday 24th April, 2006

              A Offline
              A Offline
              alexey N
              wrote on last edited by
              #6

              I think, that you've forgot to dispose some GDI+ objects. For example, Graphics Best regards, Alexey.

              1 Reply Last reply
              0
              • C CherezZaboro

                I'm getting very often but not always some kind of error dialog when I quit my app in C# that uses some COM objects. Unfortunately I can't tell what it is because when it pops up the application closes in like 10th of a seccond and I can't see what's the dialog about. This is release build. Debug doesn't report anything in debugger on exit ever. I understand it's very vague but I still need help and hope someone here can help me. How to catch the error? Thanks a lot for help in advance!

                A Offline
                A Offline
                alexey N
                wrote on last edited by
                #7

                I think, that you've forgot to dispose some COM objects. Try to set them null value. To see this error, try to set Thread.Sleep(time); after Application.Run(...) with time in milliseconds. Best regards, Alexey.

                C 1 Reply Last reply
                0
                • M mav northwind

                  Hi! Have you tried catching a ThreadException in your main thread? Could be worth a try... Regards, mav -- Black holes are the places where god divided by 0...

                  C Offline
                  C Offline
                  CherezZaboro
                  wrote on last edited by
                  #8

                  Yeah. But exception seems to pop up after main - when GC is collecting - i'm thinking - and there's no way to trap that.

                  1 Reply Last reply
                  0
                  • T Tom Larsen

                    It is possible to set a break point at the bottom of your main on Closing for the main form. Or if worse comes to worse, create a temporary button that behaves like "Quit" with your break point there.

                    C Offline
                    C Offline
                    CherezZaboro
                    wrote on last edited by
                    #9

                    But exception seems to pop up after main in - when GC is collecting - i'm thinking - and there's no way to trap that.

                    1 Reply Last reply
                    0
                    • A alexey N

                      I think, that you've forgot to dispose some COM objects. Try to set them null value. To see this error, try to set Thread.Sleep(time); after Application.Run(...) with time in milliseconds. Best regards, Alexey.

                      C Offline
                      C Offline
                      CherezZaboro
                      wrote on last edited by
                      #10

                      but shouldn't they be disposed when the applciation quits? what is the GC for then? In any case I think I do set them to null and even call ReleaseComObject - no help :((

                      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