Je charge une fonction nouvelle créée AppDomain et tout le travail va bien, mais si je ferme le programme, puis le renommer et le lancer à nouveau, que je ne ferai exception FileNotFound. Je ne comprends pas, comment cela peut-il être?AppDomain DoCallBack FileNotFound exception
Erreur (appDomainProject nom du programme original)
System.IO.FileNotFoundException: Could not load file or assembly "appDomainProject, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null" or one of its dependencies. Can not find the file specified.
Source
using System;
using System.IO;
using System.Windows.Forms;
namespace appDomainProject
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try
{
AppDomain authDomain = AppDomain.CreateDomain(DateTime.Now.ToString());
authDomain.DoCallBack(load_Auth);
}
catch (Exception ex)
{
File.WriteAllText("e.txt", ex.ToString());;
MessageBox.Show(ex.ToString());
}
}
private static void load_Auth()
{
MessageBox.Show("AUTH");
}
}
}
: « fermer le programme et renommez-le ", vous voulez dire que vous renommez le fichier exe, aucune reconstruction impliquée, rien enregistré dans GAC ou NGen etc.? – dlatikay
Oui, il suffit de renommer sans reconstruire – SLI
peut reproduire. Echoue dans la ligne source 21, 'DoCallBack'. Fait intéressant, un Q qui ressemble à un double de celui-ci, a été supprimée de SO: http://stackoverflow.com/questions/30512932/execute-code-in-appdomain-in-renamed-executables – dlatikay