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. Other Discussions
  3. The Insider News
  4. C# 6 Exception Filters and How they are much more than Syntactic Sugar

C# 6 Exception Filters and How they are much more than Syntactic Sugar

Scheduled Pinned Locked Moved The Insider News
csharpdatabasecomquestion
16 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.
  • T TheGreatAndPowerfulOz

    If that's VB in your signature then I'm a monkey's uncle. :laugh: :laugh: :laugh: :laugh: :laugh:

    If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
    You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

    Sander RosselS Offline
    Sander RosselS Offline
    Sander Rossel
    wrote on last edited by
    #7

    You're right, it's actually F# :sigh:

    My blog[^]

    public class SanderRossel : Lazy<Person>
    {
    public void DoWork()
    {
    throw new NotSupportedException();
    }
    }

    T 1 Reply Last reply
    0
    • Sander RosselS Sander Rossel

      You're right, it's actually F# :sigh:

      My blog[^]

      public class SanderRossel : Lazy<Person>
      {
      public void DoWork()
      {
      throw new NotSupportedException();
      }
      }

      T Offline
      T Offline
      TheGreatAndPowerfulOz
      wrote on last edited by
      #8

      That's not F# either. :rolleyes:

      If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
      You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

      Sander RosselS 1 Reply Last reply
      0
      • T TheGreatAndPowerfulOz

        That's not F# either. :rolleyes:

        If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
        You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
        Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

        Sander RosselS Offline
        Sander RosselS Offline
        Sander Rossel
        wrote on last edited by
        #9

        Assembler?

        My blog[^]

        public class SanderRossel : Lazy<Person>
        {
        public void DoWork()
        {
        throw new NotSupportedException();
        }
        }

        D 1 Reply Last reply
        0
        • T tgrt

          I have a question, but I didn't want to sign-up at the site to ask it. I suppose this is a programming question, so I won't delve into it other than point out a flaw in the article. In the example he specifies a use case of logging without unwinding the stack. The premise sounds good except that at the point he logs he has no context for the exception. The most he can log is that there was an exception and maybe pass in some state information on a method overload. The exception object hasn't been created yet. I could be missing something. His original does the same thing -- there is no context to the exception.

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #10

          The exception object has been created - it's just that the examples on that blog post don't show it. You could easily do:

          try
          {
          ...
          }
          catch (SomeException ex) if (Log(ex))
          {
          }

          This blog post[^] has a better example.


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          1 Reply Last reply
          0
          • Sander RosselS Sander Rossel

            Assembler?

            My blog[^]

            public class SanderRossel : Lazy<Person>
            {
            public void DoWork()
            {
            throw new NotSupportedException();
            }
            }

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #11

            Keep guessing. When you get to C#, stop.

            A guide to posting questions on CodeProject

            Click this: Asking questions is a skill. Seriously, do it.
            Dave Kreskowiak

            Sander RosselS 1 Reply Last reply
            0
            • T tgrt

              I have a question, but I didn't want to sign-up at the site to ask it. I suppose this is a programming question, so I won't delve into it other than point out a flaw in the article. In the example he specifies a use case of logging without unwinding the stack. The premise sounds good except that at the point he logs he has no context for the exception. The most he can log is that there was an exception and maybe pass in some state information on a method overload. The exception object hasn't been created yet. I could be missing something. His original does the same thing -- there is no context to the exception.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #12

              Ummm...wrong. If the Exception hasn't been created yet, how is the catch block going to know about it? The Exception HAS been created by the time the catch block and the filters start executing. Ever set a breakpoint on a catch in VS? Without the catch executing, you get a little tag you can click and see the, wait for it, Exception object!

              A guide to posting questions on CodeProject

              Click this: Asking questions is a skill. Seriously, do it.
              Dave Kreskowiak

              1 Reply Last reply
              0
              • D Dave Kreskowiak

                Keep guessing. When you get to C#, stop.

                A guide to posting questions on CodeProject

                Click this: Asking questions is a skill. Seriously, do it.
                Dave Kreskowiak

                Sander RosselS Offline
                Sander RosselS Offline
                Sander Rossel
                wrote on last edited by
                #13

                You really want me to continue? :laugh: To tell you the truth I actually know what language I wrote my own signature in. I'm just messing with you guys :D

                My blog[^]

                public class SanderRossel : Lazy<Person>
                {
                public void DoWork()
                {
                throw new NotSupportedException();
                }
                }

                D 1 Reply Last reply
                0
                • Sander RosselS Sander Rossel

                  You really want me to continue? :laugh: To tell you the truth I actually know what language I wrote my own signature in. I'm just messing with you guys :D

                  My blog[^]

                  public class SanderRossel : Lazy<Person>
                  {
                  public void DoWork()
                  {
                  throw new NotSupportedException();
                  }
                  }

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #14

                  Dude, with the tpye and quality of a lot of the questions that show up around here, I wouldn't doubt someone doesn't have a clue about what they put in their signature.

                  A guide to posting questions on CodeProject

                  Click this: Asking questions is a skill. Seriously, do it.
                  Dave Kreskowiak

                  Sander RosselS 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    Dude, with the tpye and quality of a lot of the questions that show up around here, I wouldn't doubt someone doesn't have a clue about what they put in their signature.

                    A guide to posting questions on CodeProject

                    Click this: Asking questions is a skill. Seriously, do it.
                    Dave Kreskowiak

                    Sander RosselS Offline
                    Sander RosselS Offline
                    Sander Rossel
                    wrote on last edited by
                    #15

                    :laugh: I sure hope you hold me in a little higher esteem :) ... Right? :~

                    My blog[^]

                    public class SanderRossel : Lazy<Person>
                    {
                    public void DoWork()
                    {
                    throw new NotSupportedException();
                    }
                    }

                    D 1 Reply Last reply
                    0
                    • Sander RosselS Sander Rossel

                      :laugh: I sure hope you hold me in a little higher esteem :) ... Right? :~

                      My blog[^]

                      public class SanderRossel : Lazy<Person>
                      {
                      public void DoWork()
                      {
                      throw new NotSupportedException();
                      }
                      }

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #16

                      Psshhhhht. Yeah, right. :-D

                      A guide to posting questions on CodeProject

                      Click this: Asking questions is a skill. Seriously, do it.
                      Dave Kreskowiak

                      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