Ich lade eine Funktion auf neu erstellte AppDomain und alle Arbeit ist in Ordnung, aber wenn ich Programm schließe und dann umbenennen und neu starten, dann habe ich FileNotFound Ausnahme. Ich verstehe es einfach nicht, wie kann das sein?AppDomain DoCallBack FileNotFound Ausnahme
Fehler (appDomainProject ursprünglichen Programmname)
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.
Quelle
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");
}
}
}
nur um sicher zu sein: „das Programm schließen und benennen Sie es um ", meinen Sie, dass Sie die exe-Datei umbenennen, keine Neuerstellung, keine Registrierung in GAC oder NGen usw.? – dlatikay
yeap, benennen Sie es einfach ohne Umbau – SLI
kann reproduzieren. Fehler in der Quellzeile 21, 'DoCallBack'. Interessanterweise wurde ein Q, das wie ein Duplikat von diesem aussieht, aus SO gelöscht: http://stackoverflow.com/questions/30512932/execute-code-in-appdomain-in-enamed-executables – dlatikay