Repository: dotnet/runtime
File: src/coreclr/System.Private.CoreLib/src/System/Exception.CoreCLR.cs (C#)

Code before:
            {
                return false;
            }

            // Check to see if the exception already has a stack set in it.
            if (_stackTrace != null || _stackTraceString != null || _remoteStackTraceString != null)
            {
                ThrowHelper.ThrowInvalidOperationException();
            }

            return true;
        }

#if FEATURE_COMINTEROP
        // used by vm
        [UnmanagedCallersOnly]
        internal static unsafe IntPtr GetDescriptionBstr(Exception* obj, Exception* pException)
        {
            try
            {
                string message = obj->Message;
                if (string.IsNullOrEmpty(message))
                    message = obj->GetClassName();

                // Allocate the description BSTR.
                return Interop.OleAut32.SysAllocStringLen(message, (uint)message.Length);
            }
            catch (Exception ex)
            {
                *pException = ex;
                return IntPtr.Zero;
            }
        }

        // used by vm
        [UnmanagedCallersOnly]
        internal static unsafe IntPtr GetSourceBstr(Exception* obj, Exception* pException)
        {
            try
            {
                string? source = obj->Source;

                return source != null
                    ? Interop.OleAut32.SysAllocStringLen(source, (uint)source.Length)
                    : IntPtr.Zero;
            }
            catch (Exception ex)
            {
                *pException = ex;
                return IntPtr.Zero;
            }

Review comment (suggestion):
```suggestion
                return Marshal.StringToBSTR(message);
```

Code after:
            {
                return false;
            }

            // Check to see if the exception already has a stack set in it.
            if (_stackTrace != null || _stackTraceString != null || _remoteStackTraceString != null)
            {
                ThrowHelper.ThrowInvalidOperationException();
            }

            return true;
        }

#if FEATURE_COMINTEROP
        // used by vm
        [UnmanagedCallersOnly]
        internal static unsafe IntPtr GetDescriptionBstr(Exception* obj, Exception* pException)
        {
            try
            {
                string message = obj->Message;
                if (string.IsNullOrEmpty(message))
                    message = obj->GetClassName();

                // Allocate the description BSTR.
                return Marshal.StringToBSTR(message);
            }
            catch (Exception ex)
            {
                *pException = ex;
                return IntPtr.Zero;
            }
        }

        // used by vm
        [UnmanagedCallersOnly]
        internal static unsafe IntPtr GetSourceBstr(Exception* obj, Exception* pException)
        {
            try
            {
                string? source = obj->Source;

                return Marshal.StringToBSTR(source);
            }
            catch (Exception ex)
            {
                *pException = ex;
                return IntPtr.Zero;
            }
        }