起步只有3个文件:CoreRun.exe, coreclr.dll, mscorlib.dll, HelloWorld.exe
运行命令:CoreRun HelloWorld.exe
出错:
Assert failure(PID 9672 [0x000025c8], Thread: 16280 [0x3f98]): 0 ! + 0x0 (0x00000000`00000000) File: e:\dev\github\dotnet\coreclr\src\utilcode\ccomprc.cpp, Line: 814 Image : E:\Dev\GitHub\DotNet\CoreClrHelloWorld\runtime_windows\CoreRun.exe **** MessageBox invoked, title ‘CoreRun.exe - Assert Failure (PID 9672, Thread 1 6280/3f98) ‘ **** 0 ! + 0x0 (0x00000000`00000000) e:\dev\github\dotnet\coreclr\src\utilcode\ccomprc.cpp, Line: 814
启动Visual Studio进行调试,发现是因为少了mscorrc.debug.dll这个文件。
this 0x000007fdccd146b0 {coreclr.dll!CCompRC CCompRC::m_DefaultResourceDll} {m_Primary={m_LangId=0x000007fdccd146b0 L"en-US" ...} ...} CCompRC * m_Primary {m_LangId=0x000007fdccd146b0 L"en-US" m_hInst=0x0000000000000000 m_fMissing=1 } CCulturedHInstance m_pHash 0x0000000000000000 CCulturedHInstance * m_nHashSize 0 int m_csMap 0x000000a31a9cb933 void * m_pResourceFile 0x000007fdcc9cd200 L"mscorrc.debug.dll" const wchar_t * m_fpGetThreadUICultureId 0x000007fdcbde5ac8 {coreclr.dll!GetThreadUICultureId(wchar_t[85] *)} int (wchar_t[85] *) * m_fpGetThreadUICultureNames 0x000007fdcbde5d68 {coreclr.dll!GetThreadUICultureNames(StringArrayList *)} HRESULT (StringArrayList *) *
将mscorrc.debug.dll复制过来,继续运行,出现下面的错误:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly ‘System.Console, Version=999.999.999.0, Culture=neutral, PublicKeyToken=b0 3f5f7f11d50a3a‘ or one of its dependencies. The system cannot find the file spec ified. at Program.Main(String[] args)
需要System.Console程序集,将之从corefx编译出来的程序集中复制过来。
继续运行,又出错,这次是需要System.Runtime.dll,从corefx的packages文件夹(nuget packages)中复制过来(注:lib\net45子文件夹)
接下来又需要System.IO.dll,也是从corefx的packages文件夹中复制。
再接下来还需要从corefx的packages文件夹中复制3个程序集:System.Threading.dll, System.IO.FileSystem.Primitives.dll, System.Diagnostics.Debug.dll。
这时,当前文件夹一共有11个文件:
coreclr.dll CoreRun.exe HelloWorld.exe mscorlib.dll mscorrc.debug.dll System.Console.dll System.Diagnostics.Debug.dll System.IO.dll System.IO.FileSystem.Primitives.dll System.Runtime.dll System.Threading.dll
继续运行,出现新的错误:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly ‘System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ‘ or one of its dependencies. The system cannot find the file specified. at System.ConsolePal.WindowsConsoleStream..ctor(IntPtr handle, FileAccess acc ess) at System.ConsolePal.GetStandardFile(IntPtr handle, FileAccess access) at System.ConsolePal.OpenStandardOutput() at System.Console.OpenStandardOutput() at System.Console.<>c__DisplayClass3.<get_Out>b__4() at System.Console.EnsureInitialized[T](T& field, Func`1 initializer) at System.Console.get_Out() at System.Console.WriteLine(String value) at Program.DrawWindows() at Program.Main(String[] args)
System程序集就是mscorlib.dll,明明有这个文件,却说找不到。
后来换成corefx中packages\Microsoft.DotNet.CoreCLR.1.0.3-prerelease\lib\aspnetcore50中的mscrolib.dll,就不错这个错误了。
但是运行CoreRun HelloWorld.exe却无任何输出,换成CoreRun -v HelloWorld.exe出现下面的错误:
HOSTLOG: Finding GetCLRRuntimeHost(...) HOSTLOG: Calling GetCLRRuntimeHost(...) HOSTLOG: Setting ICLRRuntimeHost2 startup flags HOSTLOG: Starting ICLRRuntimeHost2 HOSTLOG: Failed to start CoreCLR. ERRORCODE: 0x80004005/E_FAIL HOSTLOG: Execution failed
一步一步就到这里,暂时没找到解决方法。
时间: 2024-11-07 03:11:00