summaryrefslogtreecommitdiff
path: root/Documentation/building/windows-debugging-instructions.md
blob: 0a2d66d35463a19df6485643e3b93682cf203ef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Debugging CoreCLR on Windows
============================

1. Perform a build of the repo.
2. Open <repo_root>\binaries\Cmake\CoreCLR.sln in VS.
3. Right click the INSTALL project and choose ‘Set as StartUp Project’
4. Bring up the properties page for the INSTALL project
5. Select Configuration Properties->Debugging from the left side tree control
6. Set Command=`$(SolutionDir)..\product\$(Platform)\$(Configuration)\corerun.exe`
	1. This points to the folder where the built runtime binaries are present.
7. Set Command Arguments=`<managed app you wish to run>` (e.g. HelloWorld.exe)
8. Set Working Directory=`$(SolutionDir)..\product\$(Platform)\$(Configuration)`
	1. This points to the folder containing CoreCLR binaries.
9. Press F11 to start debugging at wmain in corerun (or set a breakpoint in source and press F5 to run to it)
	1. As an example, set a breakpoint for the EEStartup function in ceemain.cpp to break into CoreCLR startup.

Steps 1-8 only need to be done once, and then (9) can be repeated whenever you want to start debugging. The above can be done with Visual Studio 2013.

####api-ms-win-core-* DLL missing error
If you get the `The program can't start because api-ms-win-core-winrt-string-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem` error while debugging, build the tests project. After build completes, place the required dlls from "**_..\coreclr\tests\src\packages\Microsoft.DotNet.CoreCLR.TestDependencies.1.0.0-prerelease\lib\aspnetcore50_**" alongside the coreclr.dll. See [Issue #65](https://github.com/dotnet/coreclr/issues/65) and this [topic](http://forums.dotnetfoundation.org/t/coreclr-on-win7-api-ms-win-core-winrt-string-l1-1-0-is-missing/853/4).


Debugging Mscorlib and/or managed application
=============================================

To step into and debug managed code of Mscorlib.dll (or the managed application being executed by the runtime you built), using Visual Studio, is something that will be supported with Visual Studio 2015. We are actively working to enable this support. 

Until then, you can use [WinDbg](https://msdn.microsoft.com/en-us/library/windows/hardware/ff551063(v=vs.85).aspx) and [SOS](https://msdn.microsoft.com/en-us/library/bb190764(v=vs.110).aspx) (an extension to WinDbg to support managed debugging) to step in and debug the generated managed code. This is what we do on the .NET Runtime team as well :)