From 494665d33d5f392425be6df443ac6f975097b594 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 11 Feb 2019 23:23:32 -0500 Subject: [PATCH] Delete mda.cs and related dead code (dotnet/coreclr#22535) Commit migrated from https://github.com/dotnet/coreclr/commit/1c28b497ff2d49141f6a63e3f293095161e40d00 --- .../System.Private.CoreLib.csproj | 1 - .../System.Private.CoreLib/src/System/RtType.cs | 3 - .../src/System/StubHelpers.cs | 8 +- .../src/System.Private.CoreLib/src/System/mda.cs | 71 ------- src/coreclr/src/dlls/mscorrc/mscorrc.rc | 32 ---- src/coreclr/src/dlls/mscorrc/resource.h | 4 - src/coreclr/src/vm/ecalllist.h | 13 -- src/coreclr/src/vm/mdaBoilerplate.exe.mda.config | 164 ---------------- src/coreclr/src/vm/mdaassistants.cpp | 209 --------------------- src/coreclr/src/vm/mdaassistants.h | 81 -------- src/coreclr/src/vm/mdaassistantschemas.inl | 40 +--- src/coreclr/src/vm/mdagroups.inl | 3 - 12 files changed, 2 insertions(+), 627 deletions(-) delete mode 100644 src/coreclr/src/System.Private.CoreLib/src/System/mda.cs diff --git a/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj index da4fdc6..79659fb 100644 --- a/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -167,7 +167,6 @@ - diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/RtType.cs b/src/coreclr/src/System.Private.CoreLib/src/System/RtType.cs index 3af3bfa..4f48866 100644 --- a/src/coreclr/src/System.Private.CoreLib/src/System/RtType.cs +++ b/src/coreclr/src/System.Private.CoreLib/src/System/RtType.cs @@ -231,9 +231,6 @@ namespace System internal MemberInfoCache(RuntimeTypeCache runtimeTypeCache) { -#if MDA_SUPPORTED - Mda.MemberInfoCacheCreation(); -#endif m_runtimeTypeCache = runtimeTypeCache; } diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs b/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs index 330bfe7..972a30c 100644 --- a/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs +++ b/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs @@ -1639,15 +1639,9 @@ namespace System.StubHelpers { pHandle.DangerousRelease(); } -#if MDA_SUPPORTED - catch (Exception ex) + catch { - Mda.ReportErrorSafeHandleRelease(ex); } -#else // MDA_SUPPORTED - catch (Exception) - { } -#endif // MDA_SUPPORTED } #if FEATURE_COMINTEROP diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/mda.cs b/src/coreclr/src/System.Private.CoreLib/src/System/mda.cs deleted file mode 100644 index c529a74..0000000 --- a/src/coreclr/src/System.Private.CoreLib/src/System/mda.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - - -using System.Runtime.CompilerServices; -using System.Runtime.Versioning; - -namespace System -{ -#if MDA_SUPPORTED - internal static class Mda - { - internal static class StreamWriterBufferedDataLost - { - // State: 0 (not queried); 1 (enabled); 2 (disabled) - private static volatile int _enabledState; - private static volatile int _captureAllocatedCallStackState; - - internal static bool Enabled { - get { - if (_enabledState == 0) { - if (Mda.IsStreamWriterBufferedDataLostEnabled()) - _enabledState = 1; - else - _enabledState = 2; - } - - return (_enabledState == 1); - } - } - - internal static bool CaptureAllocatedCallStack { - get { - if (_captureAllocatedCallStackState == 0) { - if (Mda.IsStreamWriterBufferedDataLostCaptureAllocatedCallStack()) - _captureAllocatedCallStackState = 1; - else - _captureAllocatedCallStackState = 2; - } - - return (_captureAllocatedCallStackState == 1); - } - } - - internal static void ReportError(String text) { - Mda.ReportStreamWriterBufferedDataLost(text); - } - - } - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void ReportStreamWriterBufferedDataLost(String text); - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern bool IsStreamWriterBufferedDataLostEnabled(); - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern bool IsStreamWriterBufferedDataLostCaptureAllocatedCallStack(); - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void MemberInfoCacheCreation(); - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void DateTimeInvalidLocalFormat(); - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void ReportErrorSafeHandleRelease(Exception ex); - } -#endif -} diff --git a/src/coreclr/src/dlls/mscorrc/mscorrc.rc b/src/coreclr/src/dlls/mscorrc/mscorrc.rc index a0616a2..6717d68 100644 --- a/src/coreclr/src/dlls/mscorrc/mscorrc.rc +++ b/src/coreclr/src/dlls/mscorrc/mscorrc.rc @@ -242,11 +242,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US L"from unmanaged to managed where an LCID was used to specify the culture for the call. This will " \ L"cause the thread's culture to remain set to the one associated with the LCID. The cause of the failure was: %1$s" -#define MDARC_MARSHALCLEANUPERROR_SAFEHANDLERELEASE_MSG \ - L"The CLR marshaler encountered an error while attempting to release the reference to a SafeHandle " \ - L"it acquired in order to marshal the SafeHandle to an unmanaged pointer during a call from managed to unmanaged. " \ - L"This may cause the unmanaged resource the SafeHandle represents to be leaked. The cause of the failure was: %1$s" - #define MDARC_MARSHALCLEANUPERROR_SAFEHANDLEPROP_MSG \ L"The CLR marshaler encountered an error while attempting to associate a SafeHandle with an unmanaged resource. " \ L"This may cause the unmanaged resource to be leaked. The cause of the failure was: %1$s" @@ -265,9 +260,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US L"Function DllMain, called with reason DLL_PROCESS_ATTACH, returned FALSE. DLL initialization failed. " \ L"To ignore the DllMain return, set Registry value " \ L"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\.NETFramework\\IgnoreDllMainReturn to 1" - -#define MDARC_REFLECTION_PERFORMANCE_MEMBERINFOCACHECREATION_MSG \ - L"Reflection has created a memberInfo cache." #define MDARC_INVALID_MEMBER_DECLARATION_MSG \ L"The following error occurred while determining how to marshal the parameters of member '%1$s' of type '%2$s': " \ @@ -288,16 +280,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #define MDARC_DANGEROUS_THREADINGAPI_MSG \ L"User code has attempted to call the following API: '%1$s'. This may result in a deadlock in the process." -#define MDARC_DATETIME_INVALID_LOCAL_FORMAT_MSG \ - L"A UTC DateTime is being converted to text in a format that is only correct for local times. " \ - L"This can happen when calling DateTime.ToString using the 'z' format specifier, which will " \ - L"include a local time zone offset in the output. In that case, either use the 'Z' format specifier, " \ - L"which designates a UTC time, or use the 'o' format string, which is the recommended way to persist " \ - L"a DateTime in text. This can also occur when passing a DateTime to be serialized by " \ - L"XmlConvert or DataSet. If using XmlConvert.ToString, pass in " \ - L"XmlDateTimeSerializationMode.RoundtripKind to serialize correctly. If using DataSet, set the " \ - L"DateTimeMode on the DataColumn object to DataSetDateTime.Utc. " - #define MDARC_NON_COMVISIBLE_BASE_CLASS_CLASSITF_MSG \ L"A QueryInterface call was made requesting the class interface of COM visible managed class '%1$s'. " \ L"However since this class derives from non COM visible class '%2$s', the QueryInterface call will fail. " \ @@ -310,16 +292,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US L"COM visible class '%2$s', the QueryInterface call will fail. This is done to prevent the non COM " \ L"visible base class from being constrained by the COM versioning rules." -#define MDARC_INVALID_GCHANDLE_COOKIE_MSG \ - L"An attempt was made to retrieve a GCHandle from an invalid IntPtr cookie (0x%1$x). " \ - L"The cookie was most likely invalid because the cookie does not represent a GCHandle, " \ - L"the GCHandle has already been freed, " \ - L"the retrieval was attempted in the wrong AppDomain, " \ - L"or the GCHandle was marshaled to native code as a GCHandle but passed back into " \ - L"managed code as an IntPtr where a cast was attempted. " \ - L"Attempting to use an invalid pointer to reclaim a GC handle can cause unexpected exceptions, crashes, " \ - L"corruption or data loss. " - #define MDARC_FATAL_EXECUTION_ENGINE_ERROR_MSG \ L"The runtime has encountered a fatal error. The address of the error was at 0x%1$08x, on thread 0x%2$x. "\ L"The error code is 0x%3$08x. This error may be a bug in the CLR or in the unsafe " \ @@ -366,7 +338,6 @@ BEGIN MDARC_DISCONNECTED_CONTEXT_2 MDARC_DISCONNECTED_CONTEXT_2_MSG MDARC_NOTMARSHALABLE MDARC_NOTMARSHALABLE_MSG MDARC_MARSHALCLEANUPERROR_THREADCULTURE MDARC_MARSHALCLEANUPERROR_THREADCULTURE_MSG - MDARC_MARSHALCLEANUPERROR_SAFEHANDLERELEASE MDARC_MARSHALCLEANUPERROR_SAFEHANDLERELEASE_MSG MDARC_MARSHALCLEANUPERROR_SAFEHANDLEPROP MDARC_MARSHALCLEANUPERROR_SAFEHANDLEPROP_MSG MDARC_MARSHALCLEANUPERROR_CUSTOMCLEANUP MDARC_MARSHALCLEANUPERROR_CUSTOMCLEANUP_MSG MDARC_INVALID_IUNKNOWN MDARC_INVALID_IUNKNOWN_MSG @@ -380,14 +351,11 @@ BEGIN MDARC_OPENGENERIC_CER_CALL MDARC_OPENGENERIC_CER_CALL_MSG MDARC_ILLEGAL_PCR MDARC_ILLEGAL_PCR_MSG MDARC_SAFEHANDLE_CRITICAL_FAILURE MDARC_SAFEHANDLE_CRITICAL_FAILURE_MSG - MDARC_REFLECTION_PERFORMANCE_MEMBERINFOCACHECREATION MDARC_REFLECTION_PERFORMANCE_MEMBERINFOCACHECREATION_MSG - MDARC_DATETIME_INVALID_LOCAL_FORMAT MDARC_DATETIME_INVALID_LOCAL_FORMAT_MSG MDARC_DLLMAIN_RETURNS_FALSE MDARC_DLLMAIN_RETURNS_FALSE_MSG MDARC_INVALID_MEMBER_DECLARATION MDARC_INVALID_MEMBER_DECLARATION_MSG MDARC_EXCEPTION_SWALLOWED_COM_TO_CLR MDARC_EXCEPTION_SWALLOWED_COM_TO_CLR_MSG MDARC_NON_COMVISIBLE_BASE_CLASS_CLASSITF MDARC_NON_COMVISIBLE_BASE_CLASS_CLASSITF_MSG MDARC_NON_COMVISIBLE_BASE_CLASS_IDISPATCH MDARC_NON_COMVISIBLE_BASE_CLASS_IDISPATCH_MSG - MDARC_INVALID_GCHANDLE_COOKIE MDARC_INVALID_GCHANDLE_COOKIE_MSG MDARC_PINVOKE_LOG MDARC_PINVOKE_LOG_MSG MDARC_FATAL_EXECUTION_ENGINE_ERROR MDARC_FATAL_EXECUTION_ENGINE_ERROR_MSG MDARC_INVALID_OVERLAPPED_TO_PINVOKE MDARC_INVALID_OVERLAPPED_TO_PINVOKE_MSG diff --git a/src/coreclr/src/dlls/mscorrc/resource.h b/src/coreclr/src/dlls/mscorrc/resource.h index 6d137f7..cbd03b6 100644 --- a/src/coreclr/src/dlls/mscorrc/resource.h +++ b/src/coreclr/src/dlls/mscorrc/resource.h @@ -46,25 +46,21 @@ #define MDARC_OPENGENERIC_CER_CALL 0x1913 #define MDARC_ILLEGAL_PCR 0x1914 #define MDARC_MARSHALCLEANUPERROR_THREADCULTURE 0x1915 -#define MDARC_MARSHALCLEANUPERROR_SAFEHANDLERELEASE 0x1916 #define MDARC_MARSHALCLEANUPERROR_SAFEHANDLEPROP 0x1917 #define MDARC_MARSHALCLEANUPERROR_CUSTOMCLEANUP 0x1918 #define MDARC_SAFEHANDLE_CRITICAL_FAILURE 0x1919 #define MDARC_DLLMAIN_RETURNS_FALSE 0x191A -#define MDARC_REFLECTION_PERFORMANCE_MEMBERINFOCACHECREATION 0x191B #define MDARC_DOCUMENTATION 0x191E #define MDARC_ASYNCHRONOUS_THREADABORT 0x191F #define MDARC_LOAD_FROM_CONTEXT 0x1920 #define MDARC_CONTEXT_SWITCH_DEADLOCK 0x1921 #define MDARC_RCW_CLEANUP_RACE 0x1923 -#define MDARC_DATETIME_INVALID_LOCAL_FORMAT 0x1924 #define MDARC_INVALID_MEMBER_DECLARATION 0x1925 #define MDARC_EXCEPTION_SWALLOWED_COM_TO_CLR 0x1926 #define MDARC_REENTRANCY 0x1928 #define MDARC_NON_COMVISIBLE_BASE_CLASS_CLASSITF 0x1929 #define MDARC_NON_COMVISIBLE_BASE_CLASS_IDISPATCH 0x192A #define MDARC_BINDING_FAILURE 0x192B -#define MDARC_INVALID_GCHANDLE_COOKIE 0x192C #define MDARC_REPORT_AV_ON_COM_RELEASE_WITH_VTABLE 0x192D #define MDARC_PINVOKE_LOG 0x192E #define MDARC_FATAL_EXECUTION_ENGINE_ERROR 0x192F diff --git a/src/coreclr/src/vm/ecalllist.h b/src/coreclr/src/vm/ecalllist.h index aff7025..9d3a7e9 100644 --- a/src/coreclr/src/vm/ecalllist.h +++ b/src/coreclr/src/vm/ecalllist.h @@ -545,19 +545,6 @@ FCFuncStart(gAssemblyBuilderFuncs) FCFuncElement("GetInMemoryAssemblyModule", AssemblyNative::GetInMemoryAssemblyModule) FCFuncEnd() -#ifdef MDA_SUPPORTED -FCFuncStart(gMda) - FCFuncElement("MemberInfoCacheCreation", MdaManagedSupport::MemberInfoCacheCreation) - FCFuncElement("DateTimeInvalidLocalFormat", MdaManagedSupport::DateTimeInvalidLocalFormat) - FCFuncElement("IsStreamWriterBufferedDataLostEnabled", MdaManagedSupport::IsStreamWriterBufferedDataLostEnabled) - FCFuncElement("IsStreamWriterBufferedDataLostCaptureAllocatedCallStack", MdaManagedSupport::IsStreamWriterBufferedDataLostCaptureAllocatedCallStack) - FCFuncElement("ReportStreamWriterBufferedDataLost", MdaManagedSupport::ReportStreamWriterBufferedDataLost) - FCFuncElement("IsInvalidGCHandleCookieProbeEnabled", MdaManagedSupport::IsInvalidGCHandleCookieProbeEnabled) - FCFuncElement("FireInvalidGCHandleCookieProbe", MdaManagedSupport::FireInvalidGCHandleCookieProbe) - FCFuncElement("ReportErrorSafeHandleRelease", MdaManagedSupport::ReportErrorSafeHandleRelease) -FCFuncEnd() -#endif // MDA_SUPPORTED - FCFuncStart(gDelegateFuncs) FCFuncElement("BindToMethodName", COMDelegate::BindToMethodName) FCFuncElement("BindToMethodInfo", COMDelegate::BindToMethodInfo) diff --git a/src/coreclr/src/vm/mdaBoilerplate.exe.mda.config b/src/coreclr/src/vm/mdaBoilerplate.exe.mda.config index 1cbd200..c75d7aa 100644 --- a/src/coreclr/src/vm/mdaBoilerplate.exe.mda.config +++ b/src/coreclr/src/vm/mdaBoilerplate.exe.mda.config @@ -192,67 +192,6 @@ ACTIVATION\REPORTING SCENARIOS: --> - - - - - - - - -