Error using reflection from a BizTalk orchestration


  • Hello.

    I have the following static method inside a class contained in a .NET class library.

     public static AbstractLog GetObjetoLog()
                AbstractLog objLog = null;
                Type tipo = null;

                //Obtain the class type of an object
                tipo = Type.GetType(Xunta.IFRT.ModulosComunesESB.Log.Facade.FachadaLog, Xunta.IFRT.ModulosComunesESB, Version=, Culture=neutral, PublicKeyToken=a8e38e545b78a460);

    //Construct an object using reflection with its default constructor
     objLog = (AbstractLog)tipo.GetConstructor(Type.EmptyTypes).Invoke(null);

                return objLog;

    If I execute this method ouside a BizTalk orchestration with a Visual Studio 2010 unit test, it works fine. Otherwise, if I execute this code inside a orchestration (inside a expression shape) the following exception is thrown:

    Activator.CreateInstance (tipo)    'Activator.CreateInstance (tipo)' threw an exception of type 'System.Reflection.TargetInvocationException'    object {System.Reflection.TargetInvocationException}

    I'm using BizTalk Server 2010 and .NET Framework 4.0. The assembly Xunta.IFRT.ModulosComunesESB.dll is registered in the GAC.

    Can someone help me? I can't instantiate this object using reflection from a BizTalk orchestration.


    Best regards.

    2012年1月30日 16:30