diff options
31 files changed, 41 insertions, 301 deletions
diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h index 96cd11014a..c28f01118c 100644 --- a/src/inc/clrconfigvalues.h +++ b/src/inc/clrconfigvalues.h @@ -149,21 +149,6 @@ RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_DesignerNamespaceResolutionEnabled, W("desi CONFIG_DWORD_INFO_EX(INTERNAL_GetAssemblyIfLoadedIgnoreRidMap, W("GetAssemblyIfLoadedIgnoreRidMap"), 0, "Used to force loader to ignore assemblies cached in the rid-map", CLRConfig::REGUTIL_default) // -// BCL -// -RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_BCLCorrectnessWarnings, W("BCLCorrectnessWarnings"), "Flag a few common correctness bugs in the library with additional runtime checks.") -RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_BCLPerfWarnings, W("BCLPerfWarnings"), "Flag some performance-related problems via asserts when people mis-use the library.") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TimeSpan_LegacyFormatMode, W("TimeSpan_LegacyFormatMode"), 0, "Flag to enable System.TimeSpan legacy (.NET Framework 3.5 and earlier) ToString behavior.") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_CompatSortNLSVersion, W("CompatSortNLSVersion"), 0, "Determines the version of desired sorting behavior for AppCompat.") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_NetFx45_CultureAwareComparerGetHashCode_LongStrings, W("NetFx45_CultureAwareComparerGetHashCode_LongStrings"), 0, "Opt in to use the new (as of v4.5) constant space hash algorithm for strings") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Resources_DisableUserPreferredFallback, W("DisableUserPreferredFallback"), 0, "Resource lookups should be dependent only on the CurrentUICulture, not a user-defined list of preferred languages nor the OS preferred fallback language. Intended to avoid falling back to a right-to-left language, which is undisplayable in console apps.") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_RelativeBindForResources , W("relativeBindForResources"), 0, "Enables probing for satellite assemblies only next to the parent assembly") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_NetFx45_LegacyManagedDeflateStream, W("NetFx45_LegacyManagedDeflateStream"), 0, "Flag to enable legacy managed implementation of the deflater used by System.IO.Compression.DeflateStream.") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DateTime_NetFX35ParseMode, W("DateTime_NetFX35ParseMode"), 0, "Flag to enable the .NET 3.5 System.DateTime Token Replacement Policy") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ThrowUnobservedTaskExceptions, W("ThrowUnobservedTaskExceptions"), 0, "Flag to propagate unobserved task exceptions on the finalizer thread.") -RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DateTime_NetFX40AmPmParseAdjustment, W("EnableAmPmParseAdjustment"), 0, "Flag to enable the .NET 4.0 DateTimeParse to correctly parse AM/PM cases") - -// // Conditional breakpoints // RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_BreakOnBadExit, W("BreakOnBadExit"), 0, "", CLRConfig::REGUTIL_default) @@ -1062,7 +1047,6 @@ RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_RepositoryFlags, W("RepositoryFl RETAIL_CONFIG_STRING_INFO(EXTERNAL_RestrictedGCStressExe, W("RestrictedGCStressExe"), "") CONFIG_DWORD_INFO_EX(INTERNAL_ReturnSourceTypeForTesting, W("ReturnSourceTypeForTesting"), 0, "allows returning the (internal only) source type of an IL to Native mapping for debugging purposes", CLRConfig::REGUTIL_default) RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_RSStressLog, W("RSStressLog"), 0, "allows turning on logging for RS startup", CLRConfig::REGUTIL_default) -RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SafeHandleStackTraces, W("SafeHandleStackTraces"), "Debug-only ability to get a stack trace attached to every SafeHandle instance at creation time, for tracking down handle corruption problems.") CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SaveThreadInfo, W("SaveThreadInfo"), "") CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SaveThreadInfoMask, W("SaveThreadInfoMask"), "") CONFIG_DWORD_INFO(INTERNAL_SBDumpOnNewIndex, W("SBDumpOnNewIndex"), 0, "Used for Syncblock debugging. It's been a while since any of those have been used.") diff --git a/src/mscorlib/Common/System/SR.cs b/src/mscorlib/Common/System/SR.cs index 29f3970633..60c382092a 100644 --- a/src/mscorlib/Common/System/SR.cs +++ b/src/mscorlib/Common/System/SR.cs @@ -100,7 +100,6 @@ namespace System // Note: our infrastructure for reporting this exception will again cause resource lookup. // This is the most direct way of dealing with that problem. string message = $"Infinite recursion during resource lookup within {System.CoreLib.Name}. This may be a bug in {System.CoreLib.Name}, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names. Resource name: {key}"; - Assert.Fail("[Recursive resource lookup bug]", message, Assert.COR_E_FAILFAST, System.Diagnostics.StackTrace.TraceFormat.NoResourceLookup); Environment.FailFast(message); } if (_currentlyLoading == null) diff --git a/src/mscorlib/shared/System/Globalization/PersianCalendar.cs b/src/mscorlib/shared/System/Globalization/PersianCalendar.cs index a80c6ece5b..10912f85b1 100644 --- a/src/mscorlib/shared/System/Globalization/PersianCalendar.cs +++ b/src/mscorlib/shared/System/Globalization/PersianCalendar.cs @@ -519,7 +519,6 @@ namespace System.Globalization int daysInMonth = GetDaysInMonth(year, month, era); if (day < 1 || day > daysInMonth) { - // BCLDebug.Log("year = " + year + ", month = " + month + ", day = " + day); throw new ArgumentOutOfRangeException( nameof(day), String.Format( diff --git a/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs b/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs index 52224637b0..120a74f8c1 100644 --- a/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs +++ b/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs @@ -101,7 +101,7 @@ namespace Microsoft.Win32 { Debug.Assert(ctype != null); #if _DEBUG - BCLDebug.Assert(ClassTypes[CV_OBJECT] == typeof(Object), "OAVariantLib::ClassTypes[CV_OBJECT] == Object.class"); + Debug.Assert(ClassTypes[CV_OBJECT] == typeof(Object), "OAVariantLib::ClassTypes[CV_OBJECT] == Object.class"); #endif int cvtype = -1; diff --git a/src/mscorlib/src/Microsoft/Win32/Registry.cs b/src/mscorlib/src/Microsoft/Win32/Registry.cs index d0dbb0ff7f..11f95903af 100644 --- a/src/mscorlib/src/Microsoft/Win32/Registry.cs +++ b/src/mscorlib/src/Microsoft/Win32/Registry.cs @@ -4,6 +4,7 @@ using System; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -123,7 +124,7 @@ namespace Microsoft.Win32 { string subKeyName; RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName); - BCLDebug.Assert(basekey != null, "basekey can't be null."); + Debug.Assert(basekey != null, "basekey can't be null."); RegistryKey key = basekey.OpenSubKey(subKeyName); if (key == null) { // if the key doesn't exist, do nothing diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs index e314c48167..6412a8f331 100644 --- a/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs +++ b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs @@ -216,7 +216,7 @@ namespace Microsoft.Win32 } // We really should throw an exception here if errorCode was bad, // but we can't for compatibility reasons. - BCLDebug.Correctness(errorCode == 0, "RegDeleteValue failed. Here's your error code: " + errorCode); + Debug.Assert(errorCode == 0, "RegDeleteValue failed. Here's your error code: " + errorCode); } /** @@ -243,8 +243,8 @@ namespace Microsoft.Win32 internal static RegistryKey GetBaseKey(IntPtr hKey, RegistryView view) { int index = ((int)hKey) & 0x0FFFFFFF; - BCLDebug.Assert(index >= 0 && index < hkeyNames.Length, "index is out of range!"); - BCLDebug.Assert((((int)hKey) & 0xFFFFFFF0) == 0x80000000, "Invalid hkey value!"); + Debug.Assert(index >= 0 && index < hkeyNames.Length, "index is out of range!"); + Debug.Assert((((int)hKey) & 0xFFFFFFF0) == 0x80000000, "Invalid hkey value!"); bool isPerf = hKey == HKEY_PERFORMANCE_DATA; // only mark the SafeHandle as ownsHandle if the key is HKEY_PERFORMANCE_DATA. @@ -539,7 +539,7 @@ namespace Microsoft.Win32 if (datasize < 0) { // unexpected code path - BCLDebug.Assert(false, "[InternalGetValue] RegQueryValue returned ERROR_SUCCESS but gave a negative datasize"); + Debug.Assert(false, "[InternalGetValue] RegQueryValue returned ERROR_SUCCESS but gave a negative datasize"); datasize = 0; } @@ -563,7 +563,7 @@ namespace Microsoft.Win32 goto case Win32Native.REG_BINARY; } long blob = 0; - BCLDebug.Assert(datasize == 8, "datasize==8"); + Debug.Assert(datasize == 8, "datasize==8"); // Here, datasize must be 8 when calling this ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, ref blob, ref datasize); @@ -578,7 +578,7 @@ namespace Microsoft.Win32 goto case Win32Native.REG_QWORD; } int blob = 0; - BCLDebug.Assert(datasize == 4, "datasize==4"); + Debug.Assert(datasize == 4, "datasize==4"); // Here, datasize must be four when calling this ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, ref blob, ref datasize); @@ -702,7 +702,7 @@ namespace Microsoft.Win32 if (nextNull < len) { - BCLDebug.Assert(blob[nextNull] == (char)0, "blob[nextNull] should be 0"); + Debug.Assert(blob[nextNull] == (char)0, "blob[nextNull] should be 0"); if (nextNull - cur > 0) { strings.Add(new String(blob, cur, nextNull - cur)); @@ -996,7 +996,7 @@ namespace Microsoft.Win32 internal static String FixupName(String name) { - BCLDebug.Assert(name != null, "[FixupName]name!=null"); + Debug.Assert(name != null, "[FixupName]name!=null"); if (name.IndexOf('\\') == -1) return name; diff --git a/src/mscorlib/src/System/BCLDebug.cs b/src/mscorlib/src/System/BCLDebug.cs index 9170a55c38..a3d108d709 100644 --- a/src/mscorlib/src/System/BCLDebug.cs +++ b/src/mscorlib/src/System/BCLDebug.cs @@ -48,9 +48,6 @@ namespace System { internal static volatile bool m_registryChecked = false; internal static volatile bool m_loggingNotEnabled = false; - internal static bool m_perfWarnings; - internal static bool m_correctnessWarnings; - internal static bool m_safeHandleStackTraces; #if _DEBUG internal static volatile bool m_domainUnloadAdded; #endif @@ -86,40 +83,6 @@ namespace System LogLevel.Trace }; - -#if _DEBUG - internal static void WaitForFinalizers(Object sender, EventArgs e) - { - if (!m_registryChecked) - { - CheckRegistry(); - } - if (m_correctnessWarnings) - { - GC.GetTotalMemory(true); - GC.WaitForPendingFinalizers(); - } - } -#endif - [Conditional("_DEBUG")] - static public void Assert(bool condition) - { -#if _DEBUG - Assert(condition, "Assert failed."); -#endif - } - - [Conditional("_DEBUG")] - static public void Assert(bool condition, String message) - { -#if _DEBUG - // Speed up debug builds marginally by avoiding the garbage from - // concatinating "BCL Assert: " and the message. - if (!condition) - System.Diagnostics.Assert.Check(condition, "BCL Assert", message); -#endif - } - [Conditional("_LOGGING")] static public void Log(String message) { @@ -165,7 +128,7 @@ namespace System // just a small helper in native code instead of that. // [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern static int GetRegistryLoggingValues(out bool loggingEnabled, out bool logToConsole, out int logLevel, out bool perfWarnings, out bool correctnessWarnings, out bool safeHandleStackTraces); + private extern static int GetRegistryLoggingValues(out bool loggingEnabled, out bool logToConsole, out int logLevel); private static void CheckRegistry() { @@ -182,7 +145,7 @@ namespace System bool logToConsole; int logLevel; int facilityValue; - facilityValue = GetRegistryLoggingValues(out loggingEnabled, out logToConsole, out logLevel, out m_perfWarnings, out m_correctnessWarnings, out m_safeHandleStackTraces); + facilityValue = GetRegistryLoggingValues(out loggingEnabled, out logToConsole, out logLevel); // Note we can get into some recursive situations where we call // ourseves recursively through the .cctor. That's why we have the @@ -198,7 +161,7 @@ namespace System //The values returned for the logging levels in the registry don't map nicely onto the //values which we support internally (which are an approximation of the ones that //the System.Diagnostics namespace uses) so we have a quick map. - Assert(logLevel >= 0 && logLevel <= 10, "logLevel>=0 && logLevel<=10"); + Debug.Assert(logLevel >= 0 && logLevel <= 10, "logLevel>=0 && logLevel<=10"); logLevel = (int)levelConversions[logLevel]; if (facilityValue > 0) @@ -314,70 +277,6 @@ namespace System System.Diagnostics.Log.LogMessage(LoggingLevels.TraceLevel0, logSwitch, StringBuilderCache.GetStringAndRelease(sb)); } - - // For perf-related asserts. On a debug build, set the registry key - // BCLPerfWarnings to non-zero. - [Conditional("_DEBUG")] - internal static void Perf(bool expr, String msg) - { - if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) - return; - if (!m_registryChecked) - CheckRegistry(); - if (!m_perfWarnings) - return; - - if (!expr) - { - Log("PERF", "BCL Perf Warning: " + msg); - } - System.Diagnostics.Assert.Check(expr, "BCL Perf Warning: Your perf may be less than perfect because...", msg); - } - - // For correctness-related asserts. On a debug build, set the registry key - // BCLCorrectnessWarnings to non-zero. - [Conditional("_DEBUG")] -#if _DEBUG -#endif - internal static void Correctness(bool expr, String msg) - { -#if _DEBUG - if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) - return; - if (!m_registryChecked) - CheckRegistry(); - if (!m_correctnessWarnings) - return; - - if (!m_domainUnloadAdded) - { - m_domainUnloadAdded = true; - AppDomain.CurrentDomain.DomainUnload += new EventHandler(WaitForFinalizers); - } - - if (!expr) - { - Log("CORRECTNESS", "BCL Correctness Warning: " + msg); - } - System.Diagnostics.Assert.Check(expr, "BCL Correctness Warning: Your program may not work because...", msg); -#endif - } - - // Whether SafeHandles include a stack trace showing where they - // were allocated. Only useful in checked & debug builds. - internal static bool SafeHandleStackTracesEnabled - { - get - { -#if _DEBUG - if (!m_registryChecked) - CheckRegistry(); - return m_safeHandleStackTraces; -#else - return false; -#endif - } - } } } diff --git a/src/mscorlib/src/System/Delegate.cs b/src/mscorlib/src/System/Delegate.cs index 188657aa7a..72586143dc 100644 --- a/src/mscorlib/src/System/Delegate.cs +++ b/src/mscorlib/src/System/Delegate.cs @@ -257,7 +257,7 @@ namespace System // RCWs don't need to be "strongly-typed" in which case we don't find a base type // that matches the declaring type of the method. This is fine because interop needs // to work with exact methods anyway so declaringType is never shared at this point. - BCLDebug.Assert(currentType != null || _target.GetType().IsCOMObject, "The class hierarchy should declare the method"); + Debug.Assert(currentType != null || _target.GetType().IsCOMObject, "The class hierarchy should declare the method"); } else { diff --git a/src/mscorlib/src/System/IO/MemoryStream.cs b/src/mscorlib/src/System/IO/MemoryStream.cs index 330efcc1e7..d2fd83d2c3 100644 --- a/src/mscorlib/src/System/IO/MemoryStream.cs +++ b/src/mscorlib/src/System/IO/MemoryStream.cs @@ -634,7 +634,6 @@ namespace System.IO public virtual byte[] ToArray() { - BCLDebug.Perf(_exposable, "MemoryStream::GetBuffer will let you avoid a copy."); byte[] copy = new byte[_length - _origin]; Buffer.InternalBlockCopy(_buffer, _origin, copy, 0, _length - _origin); return copy; diff --git a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs index bcd70c3b87..b483738213 100644 --- a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs +++ b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs @@ -375,8 +375,6 @@ namespace System.Reflection.Emit if (name[0] == '\0') throw new ArgumentException(SR.Argument_InvalidName, nameof(name)); - BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilder.DefineDynamicModule( " + name + " )"); - Debug.Assert(m_assemblyData != null, "m_assemblyData is null in DefineDynamicModuleInternal"); ModuleBuilder dynModule; @@ -672,7 +670,6 @@ namespace System.Reflection.Emit if (name.Length == 0) throw new ArgumentException(SR.Argument_EmptyName, nameof(name)); - BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilder.GetDynamicModule( " + name + " )"); int size = m_assemblyData.m_moduleBuilderList.Count; for (int i = 0; i < size; i++) { diff --git a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs index 99c055a991..ea1f6994e9 100644 --- a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs +++ b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs @@ -97,7 +97,6 @@ namespace System.Reflection.Emit // Helper to ensure the type name is unique underneath assemblyBuilder internal void CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType) { - BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilderData.CheckTypeNameConflict( " + strTypeName + " )"); for (int i = 0; i < m_moduleBuilderList.Count; i++) { ModuleBuilder curModule = m_moduleBuilderList[i]; diff --git a/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs index 53566c16b1..28c7074d06 100644 --- a/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs +++ b/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs @@ -33,8 +33,6 @@ namespace System.Reflection.Emit public FieldBuilder DefineLiteral(String literalName, Object literalValue) { - BCLDebug.Log("DYNIL", "## DYNIL LOGGING: EnumBuilder.DefineLiteral( " + literalName + " )"); - // Define the underlying field for the enum. It will be a non-static, private field with special name bit set. FieldBuilder fieldBuilder = m_typeBuilder.DefineField( literalName, @@ -46,14 +44,12 @@ namespace System.Reflection.Emit public TypeInfo CreateTypeInfo() { - BCLDebug.Log("DYNIL", "## DYNIL LOGGING: EnumBuilder.CreateType() "); return m_typeBuilder.CreateTypeInfo(); } // CreateType cause EnumBuilder to be baked. public Type CreateType() { - BCLDebug.Log("DYNIL", "## DYNIL LOGGING: EnumBuilder.CreateType() "); return m_typeBuilder.CreateType(); } diff --git a/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs b/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs index 58c99242a8..cb091f1c14 100644 --- a/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs +++ b/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs @@ -89,27 +89,13 @@ namespace System.Resources // qualified name, append path to that. if (_mediator.ModuleDir != null) { -#if _DEBUG - if (ResourceManager.DEBUG >= 3) - BCLDebug.Log("FindResourceFile: checking module dir: \"" + _mediator.ModuleDir + '\"'); -#endif - String path = Path.Combine(_mediator.ModuleDir, fileName); if (File.Exists(path)) { -#if _DEBUG - if (ResourceManager.DEBUG >= 3) - BCLDebug.Log("Found resource file in module dir! " + path); -#endif return path; } } -#if _DEBUG - if (ResourceManager.DEBUG >= 3) - BCLDebug.Log("Couldn't find resource file in module dir, checking .\\" + fileName); -#endif - // look in . if (File.Exists(fileName)) return fileName; diff --git a/src/mscorlib/src/System/Resources/ResourceManager.cs b/src/mscorlib/src/System/Resources/ResourceManager.cs index 0e9780169a..490a322c14 100644 --- a/src/mscorlib/src/System/Resources/ResourceManager.cs +++ b/src/mscorlib/src/System/Resources/ResourceManager.cs @@ -243,10 +243,6 @@ namespace System.Resources internal const String ResFileExtension = ".resources"; internal const int ResFileExtensionLength = 10; - // My private debugging aid. Set to 5 or 6 for verbose output. Set to 3 - // for summary level information. - internal static readonly int DEBUG = 0; //Making this const causes C# to consider all of the code that it guards unreachable. - private static volatile bool s_IsAppXModel; [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod diff --git a/src/mscorlib/src/System/Resources/ResourceReader.cs b/src/mscorlib/src/System/Resources/ResourceReader.cs index 0658032f7d..75c17686b3 100644 --- a/src/mscorlib/src/System/Resources/ResourceReader.cs +++ b/src/mscorlib/src/System/Resources/ResourceReader.cs @@ -106,16 +106,11 @@ namespace System.Resources // Version number of .resources file, for compatibility private int _version; -#if RESOURCE_FILE_FORMAT_DEBUG - private bool _debug; // Whether this file has debugging stuff in it. -#endif - public ResourceReader(String fileName) { _resCache = new Dictionary<String, ResourceLocator>(FastResourceComparer.Default); _store = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.RandomAccess), Encoding.UTF8); - BCLDebug.Log("RESMGRFILEFORMAT", "ResourceReader .ctor(String). UnmanagedMemoryStream: " + (_ums != null)); try { @@ -140,7 +135,6 @@ namespace System.Resources // We have a faster code path for reading resource files from an assembly. _ums = stream as UnmanagedMemoryStream; - BCLDebug.Log("RESMGRFILEFORMAT", "ResourceReader .ctor(Stream). UnmanagedMemoryStream: " + (_ums != null)); ReadResources(); } @@ -159,7 +153,6 @@ namespace System.Resources _ums = stream as UnmanagedMemoryStream; - BCLDebug.Log("RESMGRFILEFORMAT", "ResourceReader .ctor(Stream, Hashtable). UnmanagedMemoryStream: " + (_ums != null)); ReadResources(); } @@ -268,7 +261,7 @@ namespace System.Resources { Debug.Assert(_store != null, "ResourceReader is closed!"); int hash = FastResourceComparer.HashFunction(name); - BCLDebug.Log("RESMGRFILEFORMAT", "FindPosForResource for " + name + " hash: " + hash.ToString("x", CultureInfo.InvariantCulture)); + // Binary search over the hashes. Use the _namePositions array to // determine where they exist in the underlying stream. int lo = 0; @@ -288,7 +281,7 @@ namespace System.Resources c = -1; else c = 1; - //BCLDebug.Log("RESMGRFILEFORMAT", " Probing index "+index+" lo: "+lo+" hi: "+hi+" c: "+c); + if (c == 0) { success = true; @@ -301,14 +294,6 @@ namespace System.Resources } if (!success) { -#if RESOURCE_FILE_FORMAT_DEBUG - String lastReadString; - lock(this) { - _store.BaseStream.Seek(_nameSectionOffset + GetNamePosition(index), SeekOrigin.Begin); - lastReadString = _store.ReadString(); - } - BCLDebug.Log("RESMGRFILEFORMAT", LogLevel.Status, "FindPosForResource for ", name, " failed. i: ", index, " lo: ", lo, " hi: ", hi, " last read string: \"", lastReadString, '\''); -#endif return -1; } @@ -346,7 +331,6 @@ namespace System.Resources } } } - BCLDebug.Log("RESMGRFILEFORMAT", "FindPosForResource for " + name + ": Found a hash collision, HOWEVER, neither of these collided values equaled the given string."); return -1; } @@ -463,13 +447,13 @@ namespace System.Resources { _store.BaseStream.Seek(nameVA + _nameSectionOffset, SeekOrigin.Begin); SkipString(); - //BCLDebug.Log("RESMGRFILEFORMAT", "GetValueForNameIndex for index: "+index+" skip (name length): "+skip); + int dataPos = _store.ReadInt32(); if (dataPos < 0 || dataPos >= _store.BaseStream.Length - _dataSectionOffset) { throw new FormatException(SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, dataPos)); } - BCLDebug.Log("RESMGRFILEFORMAT", "GetValueForNameIndex: dataPos: " + dataPos); + ResourceTypeCode junk; if (_version == 1) return LoadObjectV1(dataPos); @@ -511,7 +495,7 @@ namespace System.Resources if (typeCode == ResourceTypeCode.String) // ignore Null s = _store.ReadString(); } - BCLDebug.Log("RESMGRFILEFORMAT", "LoadString(" + pos.ToString("x", CultureInfo.InvariantCulture) + " returned " + (s == null ? "[a null string]" : s)); + return s; } @@ -567,7 +551,6 @@ namespace System.Resources if (typeIndex == -1) return null; RuntimeType type = FindType(typeIndex); - BCLDebug.Log("RESMGRFILEFORMAT", "LoadObject type: " + type.Name + " pos: 0x" + _store.BaseStream.Position.ToString("x", CultureInfo.InvariantCulture)); // Consider putting in logic to see if this type is a // primitive or a value type first, so we can reach the // deserialization code faster for arbitrary objects. @@ -641,8 +624,6 @@ namespace System.Resources _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); typeCode = (ResourceTypeCode)_store.Read7BitEncodedInt(); - BCLDebug.Log("RESMGRFILEFORMAT", "LoadObjectV2 type: " + typeCode + " pos: 0x" + _store.BaseStream.Position.ToString("x", CultureInfo.InvariantCulture)); - switch (typeCode) { case ResourceTypeCode.Null: @@ -812,12 +793,10 @@ namespace System.Resources } if (resMgrHeaderVersion > 1) { - BCLDebug.Log("RESMGRFILEFORMAT", LogLevel.Status, "ReadResources: Unexpected ResMgr header version: {0} Skipping ahead {1} bytes.", resMgrHeaderVersion, numBytesToSkip); _store.BaseStream.Seek(numBytesToSkip, SeekOrigin.Current); } else { - BCLDebug.Log("RESMGRFILEFORMAT", "ReadResources: Parsing ResMgr header v1."); // We don't care about numBytesToSkip; read the rest of the header // Read in type name for a suitable ResourceReader @@ -840,36 +819,11 @@ namespace System.Resources throw new ArgumentException(SR.Format(SR.Arg_ResourceFileUnsupportedVersion, RuntimeResourceSet.Version, version)); _version = version; -#if RESOURCE_FILE_FORMAT_DEBUG - // Look for ***DEBUG*** to see if this is a debuggable file. - long oldPos = _store.BaseStream.Position; - _debug = false; - try { - String debugString = _store.ReadString(); - _debug = String.Equals("***DEBUG***", debugString); - } - catch(IOException) { - } - catch(OutOfMemoryException) { - } - if (_debug) { - Console.WriteLine("ResourceReader is looking at a debuggable .resources file, version {0}", _version); - } - else { - _store.BaseStream.Position = oldPos; - } -#endif - _numResources = _store.ReadInt32(); if (_numResources < 0) { throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); } - BCLDebug.Log("RESMGRFILEFORMAT", "ReadResources: Expecting " + _numResources + " resources."); -#if RESOURCE_FILE_FORMAT_DEBUG - if (ResourceManager.DEBUG >= 4) - Console.WriteLine("ResourceReader::ReadResources - Reading in "+_numResources+" resources"); -#endif // Read type positions into type positions array. // But delay initialize the type table. @@ -888,11 +842,6 @@ namespace System.Resources SkipString(); } -#if RESOURCE_FILE_FORMAT_DEBUG - if (ResourceManager.DEBUG >= 5) - Console.WriteLine("ResourceReader::ReadResources - Reading in "+numTypes+" type table entries"); -#endif - // Prepare to read in the array of name hashes // Note that the name hashes array is aligned to 8 bytes so // we can use pointers into it on 64 bit machines. (4 bytes @@ -910,13 +859,6 @@ namespace System.Resources } // Read in the array of name hashes -#if RESOURCE_FILE_FORMAT_DEBUG - // Skip over "HASHES->" - if (_debug) { - _store.BaseStream.Position += 8; - } -#endif - if (_ums == null) { _nameHashes = new int[_numResources]; @@ -943,12 +885,6 @@ namespace System.Resources } // Read in the array of relative positions for all the names. -#if RESOURCE_FILE_FORMAT_DEBUG - // Skip over "POS---->" - if (_debug) { - _store.BaseStream.Position += 8; - } -#endif if (_ums == null) { _namePositions = new int[_numResources]; @@ -995,8 +931,6 @@ namespace System.Resources { throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); } - - BCLDebug.Log("RESMGRFILEFORMAT", String.Format(CultureInfo.InvariantCulture, "ReadResources: _nameOffset = 0x{0:x} _dataOffset = 0x{1:x}", _nameSectionOffset, _dataSectionOffset)); } // This allows us to delay-initialize the Type[]. This might be a diff --git a/src/mscorlib/src/System/RtType.cs b/src/mscorlib/src/System/RtType.cs index e5bc0c5293..249b68e3f6 100644 --- a/src/mscorlib/src/System/RtType.cs +++ b/src/mscorlib/src/System/RtType.cs @@ -389,7 +389,7 @@ namespace System list = PopulateInterfaces(filter); break; default: - BCLDebug.Assert(false, "Invalid CacheType"); + Debug.Assert(false, "Invalid CacheType"); break; } diff --git a/src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs b/src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs index 08f27dc038..b9f10bc5cb 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs @@ -73,8 +73,8 @@ namespace System.Runtime.InteropServices internal static ComEventsSink Remove(ComEventsSink sinks, ComEventsSink sink) { - BCLDebug.Assert(sinks != null, "removing event sink from empty sinks collection"); - BCLDebug.Assert(sink != null, "specify event sink is null"); + Debug.Assert(sinks != null, "removing event sink from empty sinks collection"); + Debug.Assert(sink != null, "specify event sink is null"); if (sink == sinks) { @@ -145,7 +145,7 @@ namespace System.Runtime.InteropServices private void Advise(object rcw) { - BCLDebug.Assert(_connectionPoint == null, "comevent sink is already advised"); + Debug.Assert(_connectionPoint == null, "comevent sink is already advised"); ComTypes.IConnectionPointContainer cpc = (ComTypes.IConnectionPointContainer)rcw; ComTypes.IConnectionPoint cp; @@ -160,7 +160,7 @@ namespace System.Runtime.InteropServices private void Unadvise() { - BCLDebug.Assert(_connectionPoint != null, "can not unadvise from empty connection point"); + Debug.Assert(_connectionPoint != null, "can not unadvise from empty connection point"); try { diff --git a/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs b/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs index cc3462275e..2bce2ec6f4 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs @@ -135,9 +135,6 @@ namespace System.Runtime.InteropServices { // ! Do not add or rearrange fields as the EE depends on this layout. //------------------------------------------------------------------ -#if DEBUG - private String _stackTrace; // Where we allocated this CriticalHandle. -#endif protected IntPtr handle; // This must be protected so derived classes can use out params. private bool _isClosed; // Set by SetHandleAsInvalid or Close/Dispose/finalization. @@ -146,13 +143,6 @@ namespace System.Runtime.InteropServices { handle = invalidHandleValue; _isClosed = false; - -#if DEBUG - if (BCLDebug.SafeHandleStackTracesEnabled) - _stackTrace = Environment.GetStackTrace(null, false); - else - _stackTrace = "For a stack trace showing who allocated this CriticalHandle, set SafeHandleStackTraces to 1 and rerun your app."; -#endif } // Adding an empty default constructor for annotation purposes diff --git a/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs b/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs index 6654ec9b00..4c5b94fb43 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs @@ -17,6 +17,7 @@ namespace System.Runtime.InteropServices { using System; + using System.Diagnostics; using System.Reflection; using System.Threading; using System.Runtime; @@ -137,12 +138,6 @@ namespace System.Runtime.InteropServices { // ! Do not add or rearrange fields as the EE depends on this layout. //------------------------------------------------------------------ -#if DEBUG - // FxCop thinks this field is marshaled and so it raises a CA2101 error unless - // we specify this. In practice this is never presented to Win32. - [MarshalAs(UnmanagedType.LPWStr)] - private String _stackTrace; // Where we allocated this SafeHandle. -#endif protected IntPtr handle; // this must be protected so derived classes can use out params. private int _state; // Combined ref count and closed/disposed flags (so we can atomically modify them). private bool _ownsHandle; // Whether we can release this handle. @@ -162,13 +157,6 @@ namespace System.Runtime.InteropServices if (!ownsHandle) GC.SuppressFinalize(this); -#if DEBUG - if (BCLDebug.SafeHandleStackTracesEnabled) - _stackTrace = Environment.GetStackTrace(null, false); - else - _stackTrace = "For a stack trace showing who allocated this SafeHandle, set SafeHandleStackTraces to 1 and rerun your app."; -#endif - // Set this last to prevent SafeHandle's finalizer from freeing an // invalid handle. This means we don't have to worry about // ThreadAbortExceptions interrupting this constructor or the managed @@ -179,7 +167,7 @@ namespace System.Runtime.InteropServices // Migrating InheritanceDemands requires this default ctor, so we can mark it critical protected SafeHandle() { - BCLDebug.Assert(false, "SafeHandle's protected default ctor should never be used!"); + Debug.Assert(false, "SafeHandle's protected default ctor should never be used!"); throw new NotImplementedException(); } diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs index 12c77a2254..8e3856dc4f 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs @@ -315,7 +315,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // Array types are 1024 larger than their equivilent scalar counterpart - BCLDebug.Assert((int)Type > 1024, "Unexpected array PropertyType value"); + Debug.Assert((int)Type > 1024, "Unexpected array PropertyType value"); PropertyType scalarType = Type - 1024; // If we do not have the correct array type, then we need to convert the array element-by-element @@ -439,7 +439,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime } else { - BCLDebug.Assert(false, "T in coersion function wasn't understood as a type that can be coerced - make sure that CoerceScalarValue and NumericScalarTypes are in sync"); + Debug.Assert(false, "T in coersion function wasn't understood as a type that can be coerced - make sure that CoerceScalarValue and NumericScalarTypes are in sync"); } } diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs index d8fa4b3cae..7dc82ed51b 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs @@ -19,7 +19,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime public CLRIReferenceImpl(PropertyType type, T obj) : base(type, obj) { - BCLDebug.Assert(obj != null, "Must not be null"); + Debug.Assert(obj != null, "Must not be null"); _value = obj; } @@ -73,7 +73,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime public CLRIReferenceArrayImpl(PropertyType type, T[] obj) : base(type, obj) { - BCLDebug.Assert(obj != null, "Must not be null"); + Debug.Assert(obj != null, "Must not be null"); _value = obj; diff --git a/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs b/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs index 694a382148..979d5fee2a 100644 --- a/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs +++ b/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs @@ -323,7 +323,6 @@ namespace System.Runtime.Serialization { if (m_nameToIndex.ContainsKey(name)) { - BCLDebug.Trace("SER", "[SerializationInfo.AddValue]Tried to add ", name, " twice to the SI."); throw new SerializationException(SR.Serialization_SameNameTwice); } m_nameToIndex.Add(name, m_currMember); @@ -383,7 +382,6 @@ namespace System.Runtime.Serialization { throw new ArgumentNullException(nameof(name)); } - BCLDebug.Trace("SER", "[SerializationInfo.FindElement]Looking for ", name, " CurrMember is: ", m_currMember); int index; if (m_nameToIndex.TryGetValue(name, out index)) { diff --git a/src/mscorlib/src/System/SharedStatics.cs b/src/mscorlib/src/System/SharedStatics.cs index dd9c63b334..09709874a9 100644 --- a/src/mscorlib/src/System/SharedStatics.cs +++ b/src/mscorlib/src/System/SharedStatics.cs @@ -29,7 +29,7 @@ namespace System // when we set up _sharedStatics via AppDomain::SetupSharedStatics private SharedStatics() { - BCLDebug.Assert(false, "SharedStatics..ctor() is never called."); + Debug.Assert(false, "SharedStatics..ctor() is never called."); } // This is the total amount of memory currently "reserved" via diff --git a/src/mscorlib/src/System/String.cs b/src/mscorlib/src/System/String.cs index cd9689978e..fecbd7176f 100644 --- a/src/mscorlib/src/System/String.cs +++ b/src/mscorlib/src/System/String.cs @@ -858,19 +858,16 @@ namespace System public CharEnumerator GetEnumerator() { - BCLDebug.Perf(false, "Avoid using String's CharEnumerator until C# special cases foreach on String - use the indexed property on String instead."); return new CharEnumerator(this); } IEnumerator<char> IEnumerable<char>.GetEnumerator() { - BCLDebug.Perf(false, "Avoid using String's CharEnumerator until C# special cases foreach on String - use the indexed property on String instead."); return new CharEnumerator(this); } IEnumerator IEnumerable.GetEnumerator() { - BCLDebug.Perf(false, "Avoid using String's CharEnumerator until C# special cases foreach on String - use the indexed property on String instead."); return new CharEnumerator(this); } diff --git a/src/mscorlib/src/System/StubHelpers.cs b/src/mscorlib/src/System/StubHelpers.cs index ff74d4c3c5..d9bf7caf62 100644 --- a/src/mscorlib/src/System/StubHelpers.cs +++ b/src/mscorlib/src/System/StubHelpers.cs @@ -25,7 +25,7 @@ namespace System.StubHelpers unsafe static internal byte[] DoAnsiConversion(string str, bool fBestFit, bool fThrowOnUnmappableChar, out int cbLength) { byte[] buffer = new byte[(str.Length + 1) * Marshal.SystemMaxDBCSCharSize]; - BCLDebug.Assert(buffer.Length != 0); + Debug.Assert(buffer.Length != 0); fixed (byte* bufferPtr = &buffer[0]) { cbLength = str.ConvertToAnsi(bufferPtr, buffer.Length, fBestFit, fThrowOnUnmappableChar); @@ -40,7 +40,7 @@ namespace System.StubHelpers int cbLength = managedChar.ToString().ConvertToAnsi(bufferPtr, cbAllocLength, fBestFit, fThrowOnUnmappableChar); - BCLDebug.Assert(cbLength > 0, "Zero bytes returned from DoAnsiConversion in AnsiCharMarshaler.ConvertToNative"); + Debug.Assert(cbLength > 0, "Zero bytes returned from DoAnsiConversion in AnsiCharMarshaler.ConvertToNative"); return bufferPtr[0]; } @@ -256,7 +256,7 @@ namespace System.StubHelpers // of the buffer must be at least (lengthInBytes + 6) bytes. #if _DEBUG uint length = *((uint*)pNativeBuffer.ToPointer()); - BCLDebug.Assert(length >= lengthInBytes + 6, "BSTR localloc'ed buffer is too small"); + Debug.Assert(length >= lengthInBytes + 6, "BSTR localloc'ed buffer is too small"); #endif // _DEBUG // set length @@ -385,7 +385,7 @@ namespace System.StubHelpers int nbytesused; byte[] bytes = AnsiCharMarshaler.DoAnsiConversion(strManaged, fBestFit, fThrowOnUnmappableChar, out nbytesused); - BCLDebug.Assert(nbytesused < nbytes, "Insufficient buffer allocated in VBByValStrMarshaler.ConvertToNative"); + Debug.Assert(nbytesused < nbytes, "Insufficient buffer allocated in VBByValStrMarshaler.ConvertToNative"); Buffer.Memcpy(pNative, 0, bytes, 0, nbytesused); pNative[nbytesused] = 0; @@ -978,7 +978,7 @@ namespace System.StubHelpers internal AsAnyMarshaler(IntPtr pvArrayMarshaler) { // we need this in case the value being marshaled turns out to be array - BCLDebug.Assert(pvArrayMarshaler != IntPtr.Zero, "pvArrayMarshaler must not be null"); + Debug.Assert(pvArrayMarshaler != IntPtr.Zero, "pvArrayMarshaler must not be null"); this.pvArrayMarshaler = pvArrayMarshaler; backPropAction = BackPropAction.None; @@ -1533,7 +1533,7 @@ namespace System.StubHelpers public void Add(CleanupWorkListElement elem) { - BCLDebug.Assert(elem.m_owned == false, "m_owned is supposed to be false and set later by DangerousAddRef"); + Debug.Assert(elem.m_owned == false, "m_owned is supposed to be false and set later by DangerousAddRef"); m_list.Add(elem); } diff --git a/src/mscorlib/src/System/ValueType.cs b/src/mscorlib/src/System/ValueType.cs index e5b5528314..cd8d0e05aa 100644 --- a/src/mscorlib/src/System/ValueType.cs +++ b/src/mscorlib/src/System/ValueType.cs @@ -24,7 +24,6 @@ namespace System { public override bool Equals(Object obj) { - BCLDebug.Perf(false, "ValueType::Equals is not fast. " + this.GetType().FullName + " should override Equals(Object)"); if (null == obj) { return false; diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp index 5c5a1e9eaa..c6c3138e07 100644 --- a/src/vm/comutilnative.cpp +++ b/src/vm/comutilnative.cpp @@ -1957,7 +1957,7 @@ void QCALLTYPE COMInterlocked::MemoryBarrierProcessWide() FlushProcessWriteBuffers(); } -FCIMPL6(INT32, ManagedLoggingHelper::GetRegistryLoggingValues, CLR_BOOL* bLoggingEnabled, CLR_BOOL* bLogToConsole, INT32 *iLogLevel, CLR_BOOL* bPerfWarnings, CLR_BOOL* bCorrectnessWarnings, CLR_BOOL* bSafeHandleStackTraces) +FCIMPL3(INT32, ManagedLoggingHelper::GetRegistryLoggingValues, CLR_BOOL* bLoggingEnabled, CLR_BOOL* bLogToConsole, INT32 *iLogLevel) { FCALL_CONTRACT; @@ -1969,11 +1969,8 @@ FCIMPL6(INT32, ManagedLoggingHelper::GetRegistryLoggingValues, CLR_BOOL* bLoggin *bLogToConsole = (bool)(g_pConfig->GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_LogToConsole, 0)!=0); *iLogLevel = (INT32)(g_pConfig->GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_LogLevel, 0)); logFacility = (INT32)(g_pConfig->GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_ManagedLogFacility, 0)); - *bPerfWarnings = (bool)(g_pConfig->GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_BCLPerfWarnings, 0)!=0); - *bCorrectnessWarnings = (bool)(g_pConfig->GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_BCLCorrectnessWarnings, 0)!=0); - *bSafeHandleStackTraces = (bool)(g_pConfig->GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_SafeHandleStackTraces, 0)!=0); - HELPER_METHOD_FRAME_END(); \ + HELPER_METHOD_FRAME_END(); return logFacility; } diff --git a/src/vm/comutilnative.h b/src/vm/comutilnative.h index 07c57c1312..b9737cedb7 100644 --- a/src/vm/comutilnative.h +++ b/src/vm/comutilnative.h @@ -204,7 +204,7 @@ public: class ManagedLoggingHelper { public: - static FCDECL6(INT32, GetRegistryLoggingValues, CLR_BOOL* bLoggingEnabled, CLR_BOOL* bLogToConsole, INT32 *bLogLevel, CLR_BOOL* bPerfWarnings, CLR_BOOL* bCorrectnessWarnings, CLR_BOOL* bSafeHandleStackTraces); + static FCDECL3(INT32, GetRegistryLoggingValues, CLR_BOOL* bLoggingEnabled, CLR_BOOL* bLogToConsole, INT32 *bLogLevel); }; class ValueTypeHelper { diff --git a/src/vm/mscorlib.h b/src/vm/mscorlib.h index 10456e484b..e757624be3 100644 --- a/src/vm/mscorlib.h +++ b/src/vm/mscorlib.h @@ -224,9 +224,6 @@ DEFINE_CLASS(RUNTIME_CLASS, WinRT, RuntimeClass) #endif // FEATURE_COMINTEROP DEFINE_CLASS_U(Interop, CriticalHandle, CriticalHandle) -#ifdef _DEBUG -DEFINE_FIELD_U(_stackTrace, CriticalHandle, m_debugStackTrace) -#endif DEFINE_FIELD_U(handle, CriticalHandle, m_handle) DEFINE_FIELD_U(_isClosed, CriticalHandle, m_isClosed) DEFINE_CLASS(CRITICAL_HANDLE, Interop, CriticalHandle) diff --git a/src/vm/object.h b/src/vm/object.h index 7de739ab61..84ed0a5f1b 100644 --- a/src/vm/object.h +++ b/src/vm/object.h @@ -2875,9 +2875,6 @@ class SafeHandle : public Object // Modifying the order or fields of this object may require // other changes to the classlib class definition of this // object or special handling when loading this system class. -#ifdef _DEBUG - STRINGREF m_debugStackTrace; // Where we allocated this SafeHandle -#endif Volatile<LPVOID> m_handle; Volatile<INT32> m_state; // Combined ref count and closed/disposed state (for atomicity) Volatile<CLR_BOOL> m_ownsHandle; @@ -2945,9 +2942,6 @@ class CriticalHandle : public Object // Modifying the order or fields of this object may require // other changes to the classlib class definition of this // object or special handling when loading this system class. -#ifdef _DEBUG - STRINGREF m_debugStackTrace; // Where we allocated this CriticalHandle -#endif Volatile<LPVOID> m_handle; Volatile<CLR_BOOL> m_isClosed; diff --git a/src/vm/safehandle.cpp b/src/vm/safehandle.cpp index d79c5a749a..5e0626b9e7 100644 --- a/src/vm/safehandle.cpp +++ b/src/vm/safehandle.cpp @@ -62,9 +62,6 @@ void SafeHandle::AddRef() // Cannot use "this" after Release, which toggles the GC mode. SAFEHANDLEREF sh(this); -#ifdef _DEBUG - VALIDATEOBJECTREF(sh->m_debugStackTrace); -#endif _ASSERTE(sh->IsFullyInitialized()); // To prevent handle recycling security attacks we must enforce the @@ -137,9 +134,6 @@ void SafeHandle::Release(bool fDispose) // Cannot use "this" after RunReleaseMethod, which toggles the GC mode. SAFEHANDLEREF sh(this); -#ifdef _DEBUG - VALIDATEOBJECTREF(sh->m_debugStackTrace); -#endif _ASSERTE(sh->IsFullyInitialized()); // See AddRef above for the design of the synchronization here. Basically we @@ -236,9 +230,6 @@ void SafeHandle::Dispose() // Release may trigger a GC. SAFEHANDLEREF sh(this); -#ifdef _DEBUG - VALIDATEOBJECTREF(sh->m_debugStackTrace); -#endif _ASSERTE(sh->IsFullyInitialized()); GCPROTECT_BEGIN(sh); |