none
Stack trace is not printed when exception is uncaught. RRS feed

  • Question

  • I wrote a new exception Class1 (inherited from ApplicationException) in C#, threw it without catch in a console app, then I got a trace in the console after closing the debug dialog:
    Code Snippet

    Unhandled Exception: Class2: Error in the application.
       at eao.Program.Main(String[] args) in F:\VS projects\eao\eao\Program.cs:line
    16


    But if I threw in the same C# app an exception which was compiled by our compiler (still inherits from ApplicationException), I got no trace in the console.  Only part of the first line remained:
    Code Snippet

    Unhandled Exception: CLASS2



    Anyone knows the trick? How does CLR work underlying?
    Monday, May 19, 2008 3:59 AM

Answers

  • Hi Tao,

     

    I'm not familiar with Eiffel so I don't know what that Runtime would do. However I've had a look at MyException with Ildasm and the ToString() method is overridden. It looks like a type implementing the Any interface (which MyException does) calls the TaggedOut() method, while all others call the objects ToString(). TaggedOut() then just outputs the class name.

     

    Regards Ebo

    Tuesday, May 20, 2008 7:37 PM

All replies

  • Hi Tao,

     

    Have you overridden the ToString() method in your custom Exception? If not could you post the code for the excepion?

     

    Regards Ebo

    Tuesday, May 20, 2008 12:20 AM
  • Hi Ebo,

    It is an simple Eiffel class, I don't think we override ToString() at code generation.
    Code Snippet

    class
        MY_EXCEPTION

    inherit
        APPLICATION_EXCEPTION

    end

    It is meaningless to check the Eiffel code I think, we also have a runtime and base library compiled into assemblies.

    The following is the C# class I wrote to throw this exception.
    Code Snippet

        class Program
        {
            static void Main(string[] args)
            {
                throw new RootCluster.MyException();
            }
        }


    This is what printed in the console (no trace):
    Code Snippet

    Unhandled Exception: MY_EXCEPTION


    Here are the needed assemblies compiled from Eiffel.NET compiler which include RootCluster.MyException class.
    http://www.eiffelroom.com/files/bug14015.zip

    Thanks in advance.
    Tuesday, May 20, 2008 6:31 AM
  • Hi Tao,

     

    I'm not familiar with Eiffel so I don't know what that Runtime would do. However I've had a look at MyException with Ildasm and the ToString() method is overridden. It looks like a type implementing the Any interface (which MyException does) calls the TaggedOut() method, while all others call the objects ToString(). TaggedOut() then just outputs the class name.

     

    Regards Ebo

    Tuesday, May 20, 2008 7:37 PM
  • Thank you Ebo. That part I didn't spot. It is indeed the problem. Then I will have a solution.
    Wednesday, May 21, 2008 3:33 AM