I recently learned about the process for debugging managed code in Windbg with sos. I've looked through numerous examples and from what I've seen, this should work. But it doesn't. This is a .net core 3.1 app.
I'm simply trying to break inside of the very simple Main method below.
namespace ConsoleAppTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello Console App!");
ThisPrints();
}
static void ThisPrints()
{
Console.WriteLine("This is a message");
}
}
}
My process is below
- Attach to ConsoleAppTest.exe in Windbg
- Execute
sxe ld clrjit
g
These steps result in the following output:
0:000> g
ModLoad: 00007ffe`a0900000 00007ffe`a0930000 C:\Windows\System32\IMM32.DLL
ModLoad: 00007ffe`7df70000 00007ffe`7e004000 C:\Program Files\dotnet\host\fxr\3.1.8\hostfxr.dll
ModLoad: 00007ffe`64ef0000 00007ffe`64f82000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.8\hostpolicy.dll
ModLoad: 00007ffe`3c600000 00007ffe`3cb6f000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.8\coreclr.dll
ModLoad: 00007ffe`9fbb0000 00007ffe`9fcda000 C:\Windows\System32\ole32.dll
ModLoad: 00007ffe`9f690000 00007ffe`9f9e5000 C:\Windows\System32\combase.dll
ModLoad: 00007ffe`a0830000 00007ffe`a08fd000 C:\Windows\System32\OLEAUT32.dll
ModLoad: 00007ffe`9edb0000 00007ffe`9ee05000 C:\Windows\System32\SHLWAPI.dll
ModLoad: 00007ffe`9e840000 00007ffe`9e867000 C:\Windows\System32\bcrypt.dll
(5b4.40e8): Unknown exception - code 04242420 (first chance)
ModLoad: 00007ffe`32430000 00007ffe`32d4d000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.8\System.Private.CoreLib.dll
ModLoad: 00007ffe`9c000000 00007ffe`9c012000 C:\Windows\SYSTEM32\kernel.appcore.dll
ModLoad: 00007ffe`9e520000 00007ffe`9e59f000 C:\Windows\System32\bcryptPrimitives.dll
ModLoad: 00007ffe`4ad30000 00007ffe`4ae72000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.8\clrjit.dll
ntdll!NtMapViewOfSection+0x14:
00007ffe`a0a0c2a4 c3 ret
- Next I execute
!bpmd ConsoleAppTest Program.Main
g
The problem occurs after step 5, even though clrjit.dll is loaded, the break point is not hit after setting it in step 4. and I get this final output:
0:000> !bpmd ConsoleAppTest Program.Main
Adding pending breakpoints...
0:000> g
ModLoad: 00000221`90e50000 00000221`90e58000 C:\Users\Baruc\source\repos\ConsoleAppTest\ConsoleAppTest\bin\Release\netcoreapp3.1\ConsoleAppTest.dll
(5b4.40e8): CLR notification exception - code e0444143 (first chance)
Failed to set code notification
ModLoad: 00007ffe`98f60000 00007ffe`98f6e000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.8\System.Runtime.dll
(5b4.40e8): CLR notification exception - code e0444143 (first chance)
ModLoad: 00007ffe`7d360000 00007ffe`7d385000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.8\System.Console.dll
(5b4.40e8): CLR notification exception - code e0444143 (first chance)
ModLoad: 00007ffe`82050000 00007ffe`82063000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.8\System.Threading.dll
(5b4.40e8): CLR notification exception - code e0444143 (first chance)
ModLoad: 00007ffe`72720000 00007ffe`72753000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.8\System.Runtime.Extensions.dll
(5b4.40e8): CLR notification exception - code e0444143 (first chance)
ModLoad: 00007ffe`822b0000 00007ffe`822b3000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.8\System.Text.Encoding.Extensions.dll
(5b4.40e8): CLR notification exception - code e0444143 (first chance)
ntdll!NtFsControlFile+0x14:
00007ffe`a0a0c4c4 c3 ret
Any guidance will be greatly appreciated. Thanks!