Hello,
Your help Please.
I have a 3-layer application that I want to use in X ++ 2009, AxLocalizationPT (Presentation), AxLocalizationBT (Logical) and AxLocalizationDT (Data).
It throws the following error with the exception (Exception :: Internal):
System.Reflection.TargetInvocationException: Se produjo una excepción en el destino de la invocación. ---> System.IO.FileNotFoundException: No se puede cargar el archivo o ensamblado 'AxLocalizationBT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ni una de sus dependencias. El sistema no puede encontrar el archivo especificado.
Nombre de archivo: 'AxLocalizationBT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
en AxLocalizationPT.AddDataFormManager..ctor()
=== Información de estado anterior al enlace ===
LOG: Usuario = Certitech\Administrador
LOG: DisplayName = AxLocalizationBT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///D:/Program Files (x86)/Microsoft Dynamics AX/50/Client/Bin/
LOG: PrivatePath inicial = NULL
Ensamblado de llamada : AxLocalizationPT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: Este enlace empieza en el contexto de carga default.
LOG: No se encontró ningún archivo de configuración de la aplicación.
LOG: Utilizando el archivo de configuración del equipo en C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: La directiva no se está aplicando a la referencia en este momento (enlace de ensamblado privado, personalizado, parcial o basado en la ubicación).
LOG: Ya se detectó el mismo enlace, que generó un error hr = 0x80070002.
--- Fin del seguimiento de la pila de la excepción interna ---
en System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
en System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
en System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
en System.Activator.CreateInstance(Type type, Boolean nonPublic)
en System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
en System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
en ClrBridgeImpl.NewClrObject(ClrBridgeImpl* , Char* pszClassName, Char* assemblyName, Int32 argsLength, ObjectWrapper** arguments, Boolean* isException)
Here the method that compiles without errors:
public void dataSourceInfo(TableId _tableId, RecId _recId, DataAreaId _dataAreaId)
{
CompanyInfo companyInfo;
ExchRate exchRate;
System.Decimal val;
VendInvoiceJour vendInvoiceJour;
str svrErp;
AxLocalizationPT.AddDataFormManager addDataFormManager;
CodeAccessPermission permission;
System.Exception ex;
;
svrErp = SysSQLSystemInfo::construct().getLoginServer();
companyInfo = CompanyInfo::find();
if ( _tableId == 491 )
{
select vendInvoiceJour where vendInvoiceJour.RecId == _recId && vendInvoiceJour.dataAreaId == _dataAreaId;
exchRate = ExchRates::displayExchRate(vendInvoiceJour.ExchRate);
val = new System.Decimal(exchRate);
}
new InteropPermission(InteropKind::CLRInterop).assert();
try
{
addDataFormManager = new AxLocalizationPT.AddDataFormManager();
}
catch(Exception::CLRError)
{
ex = CLRInterop::getLastException();
info(ex.ToString());
}
catch (Exception::CodeAccessSecurity)
{
info("Code Access Security Error");
}
catch (Exception::Internal) // This exception handler was the Magic Sauce!!
{
ex = CLRInterop::getLastException();
if (ex)
{
info(ex.ToString());
}
else
{
info("Internal Error");
}
}
catch (Exception::Error)
{
info("None of it worked (generic Exception)");
}
addDataFormManager.initAddDataManager(_tableId, _recId, tableId2name(_tableId), _dataAreaId, val, svrErp);
}