다음 코드는 실제로 설치 프로그램 내에서 실행됩니다. 하지만 단위 테스트 프로젝트에서 호출하면 tmpDom.DoCallBack (theCallback);은 예외를 발생시킵니다. 나는 이미 'do nothing'스켈레톤으로 코드를 제거했지만 아무런 변화가 없었다.AppDomain의 DoCallBack()에 의한 예기치 않은 예외
다음과 같은 예외가 tmpDom.DoCallBack (theCallback)에 의해 발생되는using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
namespace Setup
{
internal class BMRegAsm
{
public bool RegisterDll()
{
AppDomain tmpDom = AppDomain.CreateDomain("DOMAIN-XYZ");
string theName= tmpDom.FriendlyName; // Returns the correct name!
try
{
CrossAppDomainDelegate theCallback = new CrossAppDomainDelegate(BMRegAsm.RegX);
tmpDom.DoCallBack(theCallback);
}
catch (Exception exc)
{
Trace.WriteLine("==RegisterDll== " + exc.Message);
}
}
private static void RegX() // Due to "static"-callback, no frmMain objects available.
{
}
}
}
;
==RegisterDll== Die Datei oder Assembly "Setup, Version=4.14.4.199, Culture=neutral, PublicKeyToken=null" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
죄송합니다. 즉, 시스템은 지정된 파일을 찾을 수 없습니다.
심지어 CallStack이 있는데, 나는 틀린 것을 평가할 수 없습니다. tmpDom.FriendlyName은 올바른 이름을 반환합니다.
누구나 예외를 유발하는 아이디어가 있습니까?
두 프로젝트의 출력 디렉토리가 동일에 명령한다. 코드가 파일을 사용하지 않기 때문에 필자는 파일이 누락 된 것에 놀랐습니다! –
누락 된 파일의 이름은 무엇입니까? 동일한 컴퓨터에서 테스트 응용 프로그램과 설치 응용 프로그램을 실행하고 있습니까? – KernelMode
이름이 언급되지 않았습니다. fllowing은 스택의 마지막 줄을 보여줍니다. '\t mscorlib.dll! System.Reflection.RuntimeAssembly.nLoad (System.Reflection.AssemblyName fileName, string codeBase, System.Security.Policy.Evidence assemblySecurity, System.Reflection.RuntimeAssembly locationHint, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool throwOnFileNotFound, bool forIntrospection, bool suppressSecurityChecks) \t 알 수 없음 ' –