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. .NET (Core and Framework)
  4. Mysterious error dialog on exit...

Mysterious error dialog on exit...

Scheduled Pinned Locked Moved .NET (Core and Framework)
debugginghelpcsharpcomtutorial
6 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
    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!

    E 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!

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      Does the error dialog look like a one from the framework, the COM objects or a custom one or none at all? You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

      C 1 Reply Last reply
      0
      • E Ed Poore

        Does the error dialog look like a one from the framework, the COM objects or a custom one or none at all? You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

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

        It looks like a runtime error dialog.

        E 1 Reply Last reply
        0
        • C CherezZaboro

          It looks like a runtime error dialog.

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #4

          Can you provide a bit more background as to what the application does, e.g. what are the COM objects but more importantly what is being done when your application shuts down.


          You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

          C 1 Reply Last reply
          0
          • E Ed Poore

            Can you provide a bit more background as to what the application does, e.g. what are the COM objects but more importantly what is being done when your application shuts down.


            You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

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

            I think I free all(!) the COM object using Marshal.ReleaseComObject. COM object do different things - one goes across winsock to a server the other loads msscript ctrl to execute some vbscripts. What's strange is that I have try-catch-finally in my main function of program around all those three lines including application.run, bug now debugger (debugging release) reports an thet there's an exception InvalidComObjectException beeing raised after! that try-catch-ficnally block - so after everything is run.

            E 1 Reply Last reply
            0
            • C CherezZaboro

              I think I free all(!) the COM object using Marshal.ReleaseComObject. COM object do different things - one goes across winsock to a server the other loads msscript ctrl to execute some vbscripts. What's strange is that I have try-catch-finally in my main function of program around all those three lines including application.run, bug now debugger (debugging release) reports an thet there's an exception InvalidComObjectException beeing raised after! that try-catch-ficnally block - so after everything is run.

              E Offline
              E Offline
              Ed Poore
              wrote on last edited by
              #6

              So you've basically got:

              static void Main(string[] args)
              {
              try
              {
              Application.Run(new MainForm());
              Marshal.ReleaseComObject(msscript);
              Marshal.ReleaseComObject(winsock);
              }
              catch (Exception e)
              {
              MessageBox.Show(e.ToString());
              }
              }

              Am I right? (One thing I just thought of, do you dispose the msscript or winsock first because if the msscript control is disposed of second then it might be trying to access the winsock control (if you allow this interaction)).


              You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

              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