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. Resolving the full type name

Resolving the full type name

Scheduled Pinned Locked Moved .NET (Core and Framework)
3 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.
  • V Offline
    V Offline
    Vipul Mehta
    wrote on last edited by
    #1

    Hi, We are writing an WPF application using .NET 3.5 with Enterprise Library 4.1. We have created an custom handler - UIExceptionHandler within our exe project. When we try to invoke the ExceptionPolicy.HandleException(e, "UI Message Policy"); method, we encounter the below [1] error.

    Find below my code for

    namespace CName.DName.AName.UI
    {
    [ConfigurationElementType(typeof(CustomHandlerData))]
    public class UIExceptionHandler : IExceptionHandler
    {
    public UIExceptionHandler(NameValueCollection ignore)
    {
    }

    public Exception HandleException(Exception exception, Guid handlingInstanceId) {
    DialogResult result = this.ShowThreadExceptionDialog(exception);
    return exception;
    }

    // Creates the error message and displays it.
    private DialogResult ShowThreadExceptionDialog(Exception ex)
    {return MessageBox.Show("Some Error Message", "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
    }
    }
    }

    Also find below the implementation of the custom handler in the app.config file

    <

    add name="UIExceptionPolicy">
    <exceptionTypes>
    <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">
    <exceptionHandlers>
    <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="0" useDefaultLogger="false" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Logging Handler" />
    <add type="CName.DName.AName.UI.UIExceptionHandler, CName.DName.AName.UI" name="UI Message Handler"/>
    </exceptionHandlers>
    </add>
    </exceptionTypes>
    </add>

    FYI - When I tried implementing the UIExceptionHandler custom handler class in an DLL and provided the full name in the app.config, it worked fine. But this fails when I create the handler within the exe project. The name of our exe project is Test. What might be wrong here? [1] The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, UIExceptionPolicy]) fail

    P 1 Reply Last reply
    0
    • V Vipul Mehta

      Hi, We are writing an WPF application using .NET 3.5 with Enterprise Library 4.1. We have created an custom handler - UIExceptionHandler within our exe project. When we try to invoke the ExceptionPolicy.HandleException(e, "UI Message Policy"); method, we encounter the below [1] error.

      Find below my code for

      namespace CName.DName.AName.UI
      {
      [ConfigurationElementType(typeof(CustomHandlerData))]
      public class UIExceptionHandler : IExceptionHandler
      {
      public UIExceptionHandler(NameValueCollection ignore)
      {
      }

      public Exception HandleException(Exception exception, Guid handlingInstanceId) {
      DialogResult result = this.ShowThreadExceptionDialog(exception);
      return exception;
      }

      // Creates the error message and displays it.
      private DialogResult ShowThreadExceptionDialog(Exception ex)
      {return MessageBox.Show("Some Error Message", "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
      }
      }
      }

      Also find below the implementation of the custom handler in the app.config file

      <

      add name="UIExceptionPolicy">
      <exceptionTypes>
      <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">
      <exceptionHandlers>
      <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="0" useDefaultLogger="false" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Logging Handler" />
      <add type="CName.DName.AName.UI.UIExceptionHandler, CName.DName.AName.UI" name="UI Message Handler"/>
      </exceptionHandlers>
      </add>
      </exceptionTypes>
      </add>

      FYI - When I tried implementing the UIExceptionHandler custom handler class in an DLL and provided the full name in the app.config, it worked fine. But this fails when I create the handler within the exe project. The name of our exe project is Test. What might be wrong here? [1] The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, UIExceptionPolicy]) fail

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      I don't think anybody will be able to answer your question. Try wrapping it around a bit so that it fits on the page.

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      V 1 Reply Last reply
      0
      • P Pete OHanlon

        I don't think anybody will be able to answer your question. Try wrapping it around a bit so that it fits on the page.

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys | Onyx

        V Offline
        V Offline
        Vipul Mehta
        wrote on last edited by
        #3

        I got this resolved. Within the project properties of my exe project the Assembly name was set as Test. So within the UIExceptionHandler class, I had to change the namespace from namespace CName.DName.AName.UI to namespace Test and this resolved the issue

        Regards, Vipul Mehta

        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