V10 - AfterBusinessObject method gives error when executing in Executive

2

At Executive, AfterOpenCompany already responds but gives the following error and closes the application. Even if it gives an error, the ERP has to open it. Error:

Code:

publicclassApiPlataforma:Plataforma{publicApiPlataforma(){AppDomain.CurrentDomain.AssemblyResolve+=newResolveEventHandler(CurrentDomain_AssemblyResolve);PSO.Dialogos.MostraAviso("Construtor");
    }

    public override void DepoisDeAbrirEmpresa(ExtensibilityEventArgs e)
    {
        PSO.Dialogos.MostraAviso("Depois de abrir a empresa");
        base.DepoisDeAbrirEmpresa(e);   
    }

    static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
    {
        string assemblyFullName;

        System.Reflection.AssemblyName assemblyName;

        const string PRIMAVERA_FOLDER = "PRIMAVERA\SG100\Apl";

        assemblyName = new System.Reflection.AssemblyName(args.Name);
        assemblyFullName = System.IO.Path.Combine(System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), PRIMAVERA_FOLDER), assemblyName.Name + ".dll");

        if (System.IO.File.Exists(assemblyFullName))
            return System.Reflection.Assembly.LoadFile(assemblyFullName);
        else
            return null;
    }


}
    
asked by anonymous 25.10.2018 / 18:20

0 answers