diff options
author | Stephen Toub <stoub@microsoft.com> | 2019-02-11 23:23:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-11 23:23:32 -0500 |
commit | 1c28b497ff2d49141f6a63e3f293095161e40d00 (patch) | |
tree | a8e073b5be4c9c0d69e398d41a52ec645104fda0 | |
parent | 8e5f65c4ec87cc58ea80c7473cb2946118c6ade9 (diff) | |
download | coreclr-1c28b497ff2d49141f6a63e3f293095161e40d00.tar.gz coreclr-1c28b497ff2d49141f6a63e3f293095161e40d00.tar.bz2 coreclr-1c28b497ff2d49141f6a63e3f293095161e40d00.zip |
Delete mda.cs and related dead code (#22535)
-rw-r--r-- | src/System.Private.CoreLib/System.Private.CoreLib.csproj | 1 | ||||
-rw-r--r-- | src/System.Private.CoreLib/src/System/RtType.cs | 3 | ||||
-rw-r--r-- | src/System.Private.CoreLib/src/System/StubHelpers.cs | 8 | ||||
-rw-r--r-- | src/System.Private.CoreLib/src/System/mda.cs | 71 | ||||
-rw-r--r-- | src/dlls/mscorrc/mscorrc.rc | 32 | ||||
-rw-r--r-- | src/dlls/mscorrc/resource.h | 4 | ||||
-rw-r--r-- | src/vm/ecalllist.h | 13 | ||||
-rw-r--r-- | src/vm/mdaBoilerplate.exe.mda.config | 164 | ||||
-rw-r--r-- | src/vm/mdaassistants.cpp | 209 | ||||
-rw-r--r-- | src/vm/mdaassistants.h | 81 | ||||
-rw-r--r-- | src/vm/mdaassistantschemas.inl | 40 | ||||
-rw-r--r-- | src/vm/mdagroups.inl | 3 |
12 files changed, 2 insertions, 627 deletions
diff --git a/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/System.Private.CoreLib.csproj index da4fdc6210..79659fb29e 100644 --- a/src/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -167,7 +167,6 @@ <Compile Include="$(BclSourcesRoot)\System\IO\Stream.CoreCLR.cs" /> <Compile Include="$(BclSourcesRoot)\System\Math.CoreCLR.cs" /> <Compile Include="$(BclSourcesRoot)\System\MathF.CoreCLR.cs" /> - <Compile Include="$(BclSourcesRoot)\System\mda.cs" /> <Compile Include="$(BclSourcesRoot)\System\MissingMemberException.CoreCLR.cs" /> <Compile Include="$(BclSourcesRoot)\System\MulticastDelegate.cs" /> <Compile Include="$(BclSourcesRoot)\System\Object.CoreCLR.cs" /> diff --git a/src/System.Private.CoreLib/src/System/RtType.cs b/src/System.Private.CoreLib/src/System/RtType.cs index 3af3bfa515..4f48866ef5 100644 --- a/src/System.Private.CoreLib/src/System/RtType.cs +++ b/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/System.Private.CoreLib/src/System/StubHelpers.cs b/src/System.Private.CoreLib/src/System/StubHelpers.cs index 330bfe731d..972a30c32b 100644 --- a/src/System.Private.CoreLib/src/System/StubHelpers.cs +++ b/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/System.Private.CoreLib/src/System/mda.cs b/src/System.Private.CoreLib/src/System/mda.cs deleted file mode 100644 index c529a74393..0000000000 --- a/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/dlls/mscorrc/mscorrc.rc b/src/dlls/mscorrc/mscorrc.rc index a0616a2e67..6717d68703 100644 --- a/src/dlls/mscorrc/mscorrc.rc +++ b/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/dlls/mscorrc/resource.h b/src/dlls/mscorrc/resource.h index 6d137f75bd..cbd03b6271 100644 --- a/src/dlls/mscorrc/resource.h +++ b/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/vm/ecalllist.h b/src/vm/ecalllist.h index aff7025f4b..9d3a7e9109 100644 --- a/src/vm/ecalllist.h +++ b/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/vm/mdaBoilerplate.exe.mda.config b/src/vm/mdaBoilerplate.exe.mda.config index 1cbd20037e..c75d7aa329 100644 --- a/src/vm/mdaBoilerplate.exe.mda.config +++ b/src/vm/mdaBoilerplate.exe.mda.config @@ -192,67 +192,6 @@ ACTIVATION\REPORTING SCENARIOS: --> <dangerousThreadingAPI enable="false" /> - <!-- - DateTimeInvalidLocalFormat (amoore) - - ACTIVATION: - Activated by default under a managed debugger. - - DESCRIPTION: - Indicates when a DateTime instance that represents a UTC time is formatted with a format that should - only be used with local instances. - - BEHAVIORAL IMPACT: - None. - - SCENARIOS: - - SYMPTOM: - An application is manually serializing a UTC DateTime instance using a local format: - - DateTime myDateTime = DateTime.UtcNow; - Serialize(myDateTime.ToString("yyyy-MM-dd'T'HH:mm:ss.fffffffzzz")); - - CAUSE: - The 'z' format for DateTime.ToString outputs the local time zone offset, e.g "+10:00" for Sydney time. - As such, it will only output a meaningful result if the value of the DateTime is local. If the value - is UTC, DateTime.ToString will still output the local time zone offset. - - CORRECTION: - UTC DateTime instances should be formatted in a way that indicates that they are UTC. The recommended - format for UTC times to use a 'Z' to denote UTC time: - - DateTime myDateTime = DateTime.UtcNow; - Serialize(myDateTime.ToString("yyyy-MM-dd'T'HH:mm:ss.fffffffZ")); - - There is also a short-hand "o" format that will serialize a DateTime making use of the DateTime.Kind - property that will serialize correctly regardless of whether the instance is Local, Utc or Unspecified: - - DateTime myDateTime = DateTime.UtcNow; - Serialize(myDateTime.ToString("o")); - - SYMPTOM: - An application is indirectly serializing a UTC DateTime with a library like XMLConvert or DataSet - serialization : - - DateTime myDateTime = DateTime.UtcNow; - String serialized = XMLConvert.ToString(myDateTime); - - CAUSE: - XmlConvert and DataSet serialization use local formats for serialization by default. - Additional options are required to serialize other kinds of DateTime, such as UTC. - - CORRECTION: - For XML Convert, pass in XmlConvertDateTimeOption.RoundTrip. - - DateTime myDateTime = DateTime.UtcNow; - String serialized = XmlConvert.ToString(myDateTime, XmlDateTimeSerializationMode.RoundtripKind); - - If using DataSet, set the DateTimeMode on the DataColumn object to DataSetDateTime.Utc. - - - --> - <dateTimeInvalidLocalFormat enable="false" /> <!-- DirtyCastAndCallOnInterface (chriseck) @@ -522,20 +461,6 @@ ACTIVATION\REPORTING SCENARIOS: --> <invalidFunctionPointerInDelegate enable="false" /> - <!-- - InvalidGCHandleCookie (chriseck) - - This error event is fired when an invalid IntPtr cookie->GCHandle retrieval is attempted. - The cookie is likely invalid because it was not originally created from a GCHandle, - represents a GCHandle that has already been freed, is a cookie to a GCHandle in - a different appdomain, or was marshaled to native code as a GCHandle but passed back into - the CLR as an IntPtr where a cast was attempted. - - The symptoms the user will see is undefined behavior (AVs, memory corruption, etc.) while - attempting to use or retrieve a GCHandle from a IntPtr. - --> - <invalidGCHandleCookie enable="false" /> - <!-- InvalidIUnknown (chriseck) @@ -1016,95 +941,6 @@ ACTIVATION\REPORTING SCENARIOS: <!-- - StreamWriterBufferedDataLost (BrianGru) - - DESCRIPTION: - Intended to detect when users write data to a StreamWriter but - don't flush or close the StreamWriter. That data is then lost, - because StreamWriter cannot reliably write data to the underlying - Stream from its finalizer. Users should use a using block when - possible to ensure they always close the StreamWriter. - - Poorly written code: - void Foo() { - StreamWriter sw = new StreamWriter("file.txt"); - sw.WriteLine("Data"); - // Forgot to close the StreamWriter. - } - - This MDA was implemented by adding a finalizer to StreamWriter - that looks for data in its buffer. As such, it requires your - program to get around to running finalizers before exiting. - This should happen in long-running apps automatically over time, - but can be forced in short-lived test apps (like the above) by - calling GC.Collect then GC.WaitForPendingFinalizers. - - BEHAVIORAL IMPACT: - None. - - SCENARIOS: - SYMPTOM: - User attempts to write to a file, but the last 1K - 4K of data - haven't been written to the file. This MDA detects this - data loss during finalization of the StreamWriter. - - CAUSE: - User did not properly close their StreamWriter, or arrange for - it to be flushed. - - CORRECTION: - Use the using statement in C# & VB. In managed C++, use a - try/finally to call Dispose. - - void Foo() { - using(StreamWriter sw = new StreamWriter("file.txt")) { - sw.WriteLine("Data"); - } - } - - Or users can use the long form, expanding out the using clause: - - void Foo() { - StreamWriter sw; - try { - sw = new StreamWriter("file.txt")); - sw.WriteLine("Data"); - } - finally { - if (sw != null) - sw.Close(); - } - } - - If neither of these solutions can be used (say, if you have a - StreamWriter stored in a static variable and thus you cannot - easily run code at the end of its lifetime), then calling Flush - on the StreamWriter after its last use or setting its AutoFlush - property to true before its first use will be sufficient. - Here's an example: - - internal static class Foo { - private static StreamWriter _log; - - static Foo() { // Static class constructor - StreamWriter sw = new StreamWriter("log.txt"); - sw.AutoFlush = true; - // Now publish the StreamWriter for other threads. - _log = sw; - } - } - - OUTPUT: - An XML message, indicating this violation occurred. To the - effect of "You lost data because you didn't close your - StreamWriter." It may include a file name and a stack trace - showing where the StreamWriter was allocated, to help track - down incorrect code. - --> - <streamWriterBufferedDataLost enable="true" captureAllocatedCallStack="false"/> - - - <!-- VirtualCERCall (rudim) This is just a warning. It indicates that a callsite within a CER call graph diff --git a/src/vm/mdaassistants.cpp b/src/vm/mdaassistants.cpp index 4b9a7a9d4d..a416fecdb8 100644 --- a/src/vm/mdaassistants.cpp +++ b/src/vm/mdaassistants.cpp @@ -1255,154 +1255,6 @@ void MdaBindingFailure::BindFailed(AssemblySpec *pSpec, OBJECTREF *pExceptionObj } } - -// -// MdaReflection -// -FCIMPL0(void, MdaManagedSupport::MemberInfoCacheCreation) -{ - FCALL_CONTRACT; - - HELPER_METHOD_FRAME_BEGIN_0(); - { - MdaMemberInfoCacheCreation* pMda = MDA_GET_ASSISTANT(MemberInfoCacheCreation); - if (pMda) - { - pMda->MemberInfoCacheCreation(); - } - } - HELPER_METHOD_FRAME_END(); -} -FCIMPLEND - -void MdaMemberInfoCacheCreation::MemberInfoCacheCreation() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - MdaXmlElement* pXml; - MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml); - - msg.SendMessage(MDARC_REFLECTION_PERFORMANCE_MEMBERINFOCACHECREATION); -} - - -FCIMPL0(FC_BOOL_RET, MdaManagedSupport::IsStreamWriterBufferedDataLostEnabled) -{ - FCALL_CONTRACT; - - // To see if it's enabled, allocate one then throw it away. - MdaStreamWriterBufferedDataLost* pMda = MDA_GET_ASSISTANT(StreamWriterBufferedDataLost); - - FC_RETURN_BOOL(pMda != NULL); -} -FCIMPLEND - -FCIMPL0(FC_BOOL_RET, MdaManagedSupport::IsStreamWriterBufferedDataLostCaptureAllocatedCallStack) -{ - FCALL_CONTRACT; - - // To see if it's enabled, allocate one then throw it away. - MdaStreamWriterBufferedDataLost* pMda = MDA_GET_ASSISTANT(StreamWriterBufferedDataLost); - - FC_RETURN_BOOL((pMda != NULL) && (pMda->CaptureAllocatedCallStack())); -} -FCIMPLEND - -FCIMPL1(void, MdaManagedSupport::ReportStreamWriterBufferedDataLost, StringObject * stringRef) -{ - FCALL_CONTRACT; - - STRINGREF str(stringRef); - MdaStreamWriterBufferedDataLost* pMda = MDA_GET_ASSISTANT(StreamWriterBufferedDataLost); - if (pMda) - { - HELPER_METHOD_FRAME_BEGIN_1(str); - StackSString message(str->GetBuffer()); - pMda->ReportError(message); - HELPER_METHOD_FRAME_END(); - } -} -FCIMPLEND - -FCIMPL0(FC_BOOL_RET, MdaManagedSupport::IsInvalidGCHandleCookieProbeEnabled) -{ - FCALL_CONTRACT; - - // To see if it's enabled, allocate one then throw it away. - MdaInvalidGCHandleCookie* pMda = MDA_GET_ASSISTANT(InvalidGCHandleCookie); - - FC_RETURN_BOOL(pMda != NULL); -} -FCIMPLEND - -FCIMPL1(void, MdaManagedSupport::FireInvalidGCHandleCookieProbe, LPVOID cookie) -{ - FCALL_CONTRACT; - - MdaInvalidGCHandleCookie* pMda = MDA_GET_ASSISTANT(InvalidGCHandleCookie); - if (pMda) - { - HELPER_METHOD_FRAME_BEGIN_0(); - pMda->ReportError(cookie); - HELPER_METHOD_FRAME_END(); - } -} -FCIMPLEND - -FCIMPL1(void, MdaManagedSupport::ReportErrorSafeHandleRelease, ExceptionObject * exceptionRef) -{ - FCALL_CONTRACT; - - OBJECTREF exception(exceptionRef); - MdaMarshalCleanupError* pMda = MDA_GET_ASSISTANT(MarshalCleanupError); - if (pMda) - { - HELPER_METHOD_FRAME_BEGIN_1(exception); - pMda->ReportErrorSafeHandleRelease(&exception); - HELPER_METHOD_FRAME_END(); - } -} -FCIMPLEND - -void MdaInvalidGCHandleCookie::ReportError(LPVOID cookie) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - MdaXmlElement* pXml; - MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml); - - msg.SendMessagef(MDARC_INVALID_GCHANDLE_COOKIE, cookie); -} - -void MdaStreamWriterBufferedDataLost::ReportError(SString text) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - MdaXmlElement* pXml; - MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml); - - msg.SendMessage(text); -} - - // // MdaNotMarshalable // @@ -1453,33 +1305,6 @@ void MdaMarshalCleanupError::ReportErrorThreadCulture(OBJECTREF *pExceptionObj) EX_END_CATCH(SwallowAllExceptions); } -void MdaMarshalCleanupError::ReportErrorSafeHandleRelease(OBJECTREF *pExceptionObj) -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - EX_TRY - { - MdaXmlElement* pXml; - MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml); - - // retrieve the exception message. - SString sszMessage; - GetExceptionMessage(*pExceptionObj, sszMessage); - - msg.SendMessagef(MDARC_MARSHALCLEANUPERROR_SAFEHANDLERELEASE, sszMessage.GetUnicode()); - } - EX_CATCH - { - } - EX_END_CATCH(SwallowAllExceptions); -} - void MdaMarshalCleanupError::ReportErrorSafeHandleProp(OBJECTREF *pExceptionObj) { CONTRACTL @@ -2214,39 +2039,5 @@ void MdaInvalidConfigFile::ReportError(MdaElemDeclDef configFile) report.SendMessagef(MDARC_INVALID_CONFIG_FILE, szConfigFile); } -// -// MdaDateTimeInvalidLocalFormat -// -void MdaDateTimeInvalidLocalFormat::ReportError() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - DEBUG_ONLY; - } - CONTRACTL_END; - - MdaXmlElement* pXml; - MdaXmlMessage msg(this->AsMdaAssistant(), TRUE, &pXml); - - msg.SendMessagef(MDARC_DATETIME_INVALID_LOCAL_FORMAT); -} - -FCIMPL0(void, MdaManagedSupport::DateTimeInvalidLocalFormat) -{ - FCALL_CONTRACT; - - MdaDateTimeInvalidLocalFormat* pMda = MDA_GET_ASSISTANT(DateTimeInvalidLocalFormat); - if (pMda) - { - HELPER_METHOD_FRAME_BEGIN_0(); - pMda->ReportError(); - HELPER_METHOD_FRAME_END(); - } -} -FCIMPLEND - #endif #endif //MDA_SUPPORTED diff --git a/src/vm/mdaassistants.h b/src/vm/mdaassistants.h index 1a23f30eb8..03454cb2bb 100644 --- a/src/vm/mdaassistants.h +++ b/src/vm/mdaassistants.h @@ -47,20 +47,6 @@ See the other report functions for an example (eg, MdaLoaderLock::ReportViolatio #ifdef MDA_SUPPORTED -// Until Mda offers first class support for managed code we'll just make targetd ecalls. -class MdaManagedSupport -{ -public: - static FCDECL0(void, MemberInfoCacheCreation); - static FCDECL0(void, DateTimeInvalidLocalFormat); - static FCDECL1(void, ReportStreamWriterBufferedDataLost, StringObject * pString); - static FCDECL0(FC_BOOL_RET, IsStreamWriterBufferedDataLostEnabled); - static FCDECL0(FC_BOOL_RET, IsStreamWriterBufferedDataLostCaptureAllocatedCallStack); - static FCDECL0(FC_BOOL_RET, IsInvalidGCHandleCookieProbeEnabled); - static FCDECL1(void, FireInvalidGCHandleCookieProbe, LPVOID cookie); - static FCDECL1(void, ReportErrorSafeHandleRelease, ExceptionObject * pException); -}; - // MDA classes do not derive from MdaAssistant in the type system, but, rather, use this macro to // ensure that their layout is identical to what it would be had they derived from MdaAssistant. // This allows them to be "aggregates", which C++ will allow to be initialized at compile time. @@ -145,19 +131,6 @@ public: // -// MdaReflection -// -class MdaMemberInfoCacheCreation -{ -public: - void Initialize(MdaXmlElement* pXmlInput) { WRAPPER_NO_CONTRACT; } - void MemberInfoCacheCreation(); - - MDA_ASSISTANT_BASE_MEMBERS; -}; - - -// // MdaPInvokeLog // class MdaPInvokeLog @@ -582,9 +555,6 @@ class MdaMarshalCleanupError { public: void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; } - void ReportErrorThreadCulture(OBJECTREF *pExceptionObj); - void ReportErrorSafeHandleRelease(OBJECTREF *pExceptionObj); - void ReportErrorSafeHandleProp(OBJECTREF *pExceptionObj); void ReportErrorCustomMarshalerCleanup(TypeHandle typeCustomMarshaler, OBJECTREF *pExceptionObj); MDA_ASSISTANT_BASE_MEMBERS; @@ -761,19 +731,6 @@ public: MDA_ASSISTANT_BASE_MEMBERS; }; - - -// -// InvalidGCHandleCookie -// -class MdaInvalidGCHandleCookie -{ -public: - void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; } - void ReportError(LPVOID cookie); - - MDA_ASSISTANT_BASE_MEMBERS; -}; // // MdaXmlValidator @@ -818,44 +775,6 @@ public: MDA_ASSISTANT_BASE_MEMBERS; }; -// -// MdaDateTimeInvalidLocalFormat -// -class MdaDateTimeInvalidLocalFormat -{ -public: - void Initialize(MdaXmlElement* pXmlInput) { LIMITED_METHOD_CONTRACT; } - void ReportError(); - - MDA_ASSISTANT_BASE_MEMBERS; -}; - -// -// MdaStreamWriterBufferedDataLost -// -class MdaStreamWriterBufferedDataLost -{ -public: - void Initialize(MdaXmlElement* pXmlInput) - { - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - m_captureAllocatedCallStack = pXmlInput->GetAttribute(MdaAttrDecl(CaptureAllocatedCallStack))->GetValueAsBool(); - } - - BOOL CaptureAllocatedCallStack() { LIMITED_METHOD_CONTRACT; return m_captureAllocatedCallStack; } - - void ReportError(SString text); - - MDA_ASSISTANT_BASE_MEMBERS; - BOOL m_captureAllocatedCallStack; -}; - class ValidateMdaAssistantLayout { static_assert_no_msg(sizeof(MdaAssistant) == 3); diff --git a/src/vm/mdaassistantschemas.inl b/src/vm/mdaassistantschemas.inl index 8eec09f1b4..39e0527e23 100644 --- a/src/vm/mdaassistantschemas.inl +++ b/src/vm/mdaassistantschemas.inl @@ -93,16 +93,7 @@ // Output MDA_DEFINE_OUTPUT(DangerousThreadingAPI) MDA_DEFINE_OUTPUT_END(DangerousThreadingAPI) - MDA_DEFINE_ASSISTANT_END(DangerousThreadingAPI) - - // DateTimeInvalidLocalFormat - MDA_DEFINE_ASSISTANT(DateTimeInvalidLocalFormat, NULL) - // Input - MDA_DEFINE_INPUT_AS_SWITCH(DateTimeInvalidLocalFormat) - // Output - MDA_DEFINE_OUTPUT(DateTimeInvalidLocalFormat) - MDA_DEFINE_OUTPUT_END(DateTimeInvalidLocalFormat) - MDA_DEFINE_ASSISTANT_END(DateTimeInvalidLocalFormat) + MDA_DEFINE_ASSISTANT_END(DangerousThreadingAPI) // DirtyCastAndCallOnInterface MDA_DEFINE_ASSISTANT(DirtyCastAndCallOnInterface, NULL) @@ -225,15 +216,6 @@ MDA_DEFINE_OUTPUT_END(InvalidFunctionPointerInDelegate) MDA_DEFINE_ASSISTANT_END(InvalidFunctionPointerInDelegate) - // InvalidGCHandleCookie - MDA_DEFINE_ASSISTANT(InvalidGCHandleCookie, NULL) - // Input - MDA_DEFINE_INPUT_AS_SWITCH(InvalidGCHandleCookie) - // Output - MDA_DEFINE_OUTPUT(InvalidGCHandleCookie) - MDA_DEFINE_OUTPUT_END(InvalidGCHandleCookie) - MDA_DEFINE_ASSISTANT_END(InvalidGCHandleCookie) - // InvalidIUnknown MDA_DEFINE_ASSISTANT(InvalidIUnknown, NULL) // Input @@ -352,15 +334,6 @@ MDA_DEFINE_OUTPUT_END(Marshaling) MDA_DEFINE_ASSISTANT_END(Marshaling) - // MemberInfoCacheCreation - MDA_DEFINE_ASSISTANT(MemberInfoCacheCreation, NULL) - // Input - MDA_DEFINE_INPUT_AS_SWITCH(MemberInfoCacheCreation) - // Output - MDA_DEFINE_OUTPUT(MemberInfoCacheCreation) - MDA_DEFINE_OUTPUT_END(MemberInfoCacheCreation) - MDA_DEFINE_ASSISTANT_END(MemberInfoCacheCreation) - // ModuloObjectHashcode MDA_DEFINE_ASSISTANT(ModuloObjectHashcode, W("moh")) // Input @@ -489,17 +462,6 @@ MDA_DEFINE_OUTPUT(ReportAvOnComRelease) MDA_DEFINE_OUTPUT_END(ReportAvOnComRelease) MDA_DEFINE_ASSISTANT_END(ReportAvOnComRelease) - - // StreamWriterBufferedDataLost - MDA_DEFINE_ASSISTANT(StreamWriterBufferedDataLost, NULL) - // Input - MDA_DEFINE_INPUT(StreamWriterBufferedDataLost) - MDA_XSD_ATTRIBUTE_DEFAULT(CaptureAllocatedCallStack, BOOL, W("false")) - MDA_DEFINE_INPUT_END(StreamWriterBufferedDataLost) - //Output - MDA_DEFINE_OUTPUT(StreamWriterBufferedDataLost) - MDA_DEFINE_OUTPUT_END(StreamWriterBufferedDataLost) - MDA_DEFINE_ASSISTANT_END(StreamWriterBufferedDataLost) // VirtualCERCall MDA_DEFINE_ASSISTANT(VirtualCERCall, NULL) diff --git a/src/vm/mdagroups.inl b/src/vm/mdagroups.inl index d02c60c586..7f4602ae3d 100644 --- a/src/vm/mdagroups.inl +++ b/src/vm/mdagroups.inl @@ -22,7 +22,6 @@ MDA_GROUP_DEFINITION(managedDebugger) MDA_GROUP_MEMBER(CallbackOnCollectedDelegate) MDA_GROUP_MEMBER(ContextSwitchDeadlock) MDA_GROUP_MEMBER(DangerousThreadingAPI) - MDA_GROUP_MEMBER(DateTimeInvalidLocalFormat) MDA_GROUP_MEMBER(DisconnectedContext) MDA_GROUP_MEMBER(DllMainReturnsFalse) MDA_GROUP_MEMBER(ExceptionSwallowedOnCallFromCom) @@ -45,7 +44,6 @@ MDA_GROUP_DEFINITION(managedDebugger) MDA_GROUP_MEMBER(Reentrancy) MDA_GROUP_MEMBER(ReleaseHandleFailed) MDA_GROUP_MEMBER(ReportAvOnComRelease) - MDA_GROUP_MEMBER(StreamWriterBufferedDataLost) MDA_GROUP_DEFINITION_END(managedDebugger) MDA_GROUP_DEFINITION(unmanagedDebugger) @@ -56,7 +54,6 @@ MDA_GROUP_DEFINITION_END(unmanagedDebugger) MDA_GROUP_DEFINITION(halting) MDA_GROUP_MEMBER(CallbackOnCollectedDelegate) MDA_GROUP_MEMBER(ContextSwitchDeadlock) - MDA_GROUP_MEMBER(DateTimeInvalidLocalFormat) MDA_GROUP_MEMBER(DisconnectedContext) MDA_GROUP_MEMBER(FatalExecutionEngineError) MDA_GROUP_MEMBER(InvalidFunctionPointerInDelegate) |