Uploaded image for project: 'ActiveMQ .Net'
  1. ActiveMQ .Net
  2. AMQNET-324

Add inner exceptions to the NMSException called "Error creating transport"

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5.0
    • 1.5.1, 1.6.0
    • NMS
    • None

    Description

      The latest 1.5.0 version of Apache.NMS.ActiveMQ uses reflection to find connection factories.
      However, when there are System.Reflection.ReflectionTypeLoadException (Unable to load one or more of the requested types.)
      being thrown, these exceptions and InnerExceptions are not being encaspulated and rethrown, so they are kind of difficult to spot.
      This can happen if the dll get ILMerged into another assembly, and there are some issues with this exception.

      In TransportFactory.cs:

      			try
      			{
                      factory = NewInstance(scheme.ToLower());
      			}
      			catch(NMSConnectionException)
      			{
      				throw;
      			}
      			catch
      			{
      				throw new NMSConnectionException("Error creating transport.");
      			}
      

      The NMSConnectionException("Error creating transport.") doesn't tell you the glory details.

      In FactoryFinder.cs, inside the method called private Type SearchAssembly(Assembly assembly, string factoryId) you have this:

      Type[] types = assembly.GetTypes();
      

      This code can throw ReflectionTypeLoadException and it can have multiple InnerException that will tell you why it is unable to get
      the types. It would be awesome if this exception can be propagated up to the NMSConnectionException as an InnerException.

      That way we can trace the real problem much easier.

      Attachments

        Activity

          People

            tabish Timothy A. Bish
            fgynnild Frank Gynnild
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: