diff --git a/src/SOS/SOS.Hosting/RuntimeWrapper.cs b/src/SOS/SOS.Hosting/RuntimeWrapper.cs index bfca28db91..ac37d23e01 100644 --- a/src/SOS/SOS.Hosting/RuntimeWrapper.cs +++ b/src/SOS/SOS.Hosting/RuntimeWrapper.cs @@ -158,12 +158,13 @@ protected override void Destroy() } if (_dacHandle != IntPtr.Zero) { - DataTarget.PlatformFunctions.FreeLibrary(_dacHandle); + // Previously, the DAC was freed here, but as we transition to the cDAC which uses NativeAOT, + // it is no longer possible to free the DAC library when it is using the shimmed cDAC. _dacHandle = IntPtr.Zero; } if (_cdacHandle != IntPtr.Zero) { - DataTarget.PlatformFunctions.FreeLibrary(_cdacHandle); + // cDAC can not be freed because it is a NativeAOT dll. _cdacHandle = IntPtr.Zero; } if (_dbiHandle != IntPtr.Zero)