From 90152286d2bcba35fc47e3ad82c6c16479978af6 Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Thu, 20 Jan 2022 17:15:46 -0800 Subject: [PATCH 1/2] Fix crash when VS4Mac is debugging VS4Mac arm64 Issue: https://github.com/dotnet/runtime/issues/64011 # Customer Impact VS4Mac crashes when debugging VS4Mac. # Testing VS4Mac team verified that it no longer crashes. # Risk Low. --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 39130549865e8a..696e1b7a1405c2 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -5469,6 +5469,11 @@ GENERICS_TYPE_TOKEN DacDbiInterfaceImpl::ResolveExactGenericArgsToken(DWORD if (dwExactGenericArgsTokenIndex == 0) { + // In a rare case of VS4Mac debugging VS4Mac ARM64 optimized code we get a null token for certain stack frame variables + if (rawToken == 0) + { + return rawToken; + } // In this case the real generics type token is the MethodTable of the "this" object. // Note that we want the target address here. From e87c7514bcfae7f8c2004cca00adad0862e8de06 Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Thu, 20 Jan 2022 21:34:31 -0800 Subject: [PATCH 2/2] Code review feedback. Add better comment --- src/coreclr/debug/daccess/dacdbiimpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 696e1b7a1405c2..8e587b8d1e5c26 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -5469,7 +5469,8 @@ GENERICS_TYPE_TOKEN DacDbiInterfaceImpl::ResolveExactGenericArgsToken(DWORD if (dwExactGenericArgsTokenIndex == 0) { - // In a rare case of VS4Mac debugging VS4Mac ARM64 optimized code we get a null token for certain stack frame variables + // In a rare case of VS4Mac debugging VS4Mac ARM64 optimized code we get a null generics argument token. This workaround + // should only cause us to degrade generic types from exact type parameters to approximate or canonical type parameters. if (rawToken == 0) { return rawToken;