From e69257c4c89a72efab04f4d43734b10742979c50 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Thu, 23 Dec 2021 10:00:43 -0800 Subject: [PATCH 1/3] Delete NativeAOT-specific CoreLib string resources - Fix missing localization of resource strings - Delete duplicate resource strings where possible - Delete internal or redundant messages --- .../System.Private.CoreLib/src/System/GC.cs | 17 +- src/coreclr/dlls/mscorrc/mscorrc.rc | 7 - src/coreclr/dlls/mscorrc/resource.h | 9 - .../Reflection/Augments/ReflectionAugments.cs | 3 +- .../Core/NonPortable/RuntimeTypeUnifier.cs | 3 +- .../CustomAttributeInstantiator.cs | 4 +- .../Runtime/Augments/RuntimeAugments.cs | 17 +- .../Runtime/CompilerHelpers/ArrayHelpers.cs | 2 +- .../Runtime/TypeLoaderExceptionHelper.cs | 2 - .../src/Resources/Strings.resx | 3265 ----------------- .../src/System.Private.CoreLib.csproj | 8 + .../System/Diagnostics/StackFrame.CoreRT.cs | 6 +- .../src/System/InvokeUtils.cs | 4 +- .../System/Reflection/AssemblyName.CoreRT.cs | 2 +- .../InteropServices/PInvokeMarshal.Windows.cs | 2 +- ...llocatedOverlapped.PlatformNotSupported.cs | 2 +- .../TypeSystem/Common/ExceptionStringID.cs | 1 - .../IL/ILImporter.Scanner.cs | 5 - .../JitInterface/CorInfoImpl.RyuJit.cs | 8 - src/coreclr/vm/comsynchronizable.cpp | 20 +- src/coreclr/vm/reflectioninvocation.cpp | 4 +- .../src/Resources/Strings.resx | 123 +- .../Reflection/AmbiguousMatchException.cs | 2 +- .../src/System/Threading/Thread.Mono.cs | 2 +- 24 files changed, 172 insertions(+), 3346 deletions(-) delete mode 100644 src/coreclr/nativeaot/System.Private.CoreLib/src/Resources/Strings.resx diff --git a/src/coreclr/System.Private.CoreLib/src/System/GC.cs b/src/coreclr/System.Private.CoreLib/src/System/GC.cs index 60047f746b241..7597672f68316 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/GC.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/GC.cs @@ -460,19 +460,19 @@ private static bool StartNoGCRegionWorker(long totalSize, bool hasLohSize, long { if (totalSize <= 0) { - throw new ArgumentOutOfRangeException(nameof(totalSize), "totalSize can't be zero or negative"); + throw new ArgumentOutOfRangeException(nameof(totalSize), SR.ArgumentOutOfRange_MustBePositive); } if (hasLohSize) { if (lohSize <= 0) { - throw new ArgumentOutOfRangeException(nameof(lohSize), "lohSize can't be zero or negative"); + throw new ArgumentOutOfRangeException(nameof(lohSize), SR.ArgumentOutOfRange_MustBePositive); } if (lohSize > totalSize) { - throw new ArgumentOutOfRangeException(nameof(lohSize), "lohSize can't be greater than totalSize"); + throw new ArgumentOutOfRangeException(nameof(lohSize), SR.ArgumentOutOfRange_NoGCLohSizeGreaterTotalSize); } } @@ -482,10 +482,9 @@ private static bool StartNoGCRegionWorker(long totalSize, bool hasLohSize, long case StartNoGCRegionStatus.NotEnoughMemory: return false; case StartNoGCRegionStatus.AlreadyInProgress: - throw new InvalidOperationException("The NoGCRegion mode was already in progress"); + throw new InvalidOperationException(SR.InvalidOperationException_AlreadyInNoGCRegion); case StartNoGCRegionStatus.AmountTooLarge: - throw new ArgumentOutOfRangeException(nameof(totalSize), - "totalSize is too large. For more information about setting the maximum size, see \"Latency Modes\" in https://go.microsoft.com/fwlink/?LinkId=522706"); + throw new ArgumentOutOfRangeException(nameof(totalSize), SR.ArgumentOutOfRangeException_NoGCRegionSizeTooLarge); } Debug.Assert(status == StartNoGCRegionStatus.Succeeded); @@ -516,11 +515,11 @@ public static void EndNoGCRegion() { EndNoGCRegionStatus status = (EndNoGCRegionStatus)_EndNoGCRegion(); if (status == EndNoGCRegionStatus.NotInProgress) - throw new InvalidOperationException("NoGCRegion mode must be set"); + throw new InvalidOperationException(SR.InvalidOperationException_NoGCRegionNotInProgress); else if (status == EndNoGCRegionStatus.GCInduced) - throw new InvalidOperationException("Garbage collection was induced in NoGCRegion mode"); + throw new InvalidOperationException(SR.InvalidOperationException_NoGCRegionInduced); else if (status == EndNoGCRegionStatus.AllocationExceeded) - throw new InvalidOperationException("Allocated memory exceeds specified memory for NoGCRegion mode"); + throw new InvalidOperationException(SR.InvalidOperationException_NoGCRegionAllocationExceeded); } private readonly struct MemoryLoadChangeNotification diff --git a/src/coreclr/dlls/mscorrc/mscorrc.rc b/src/coreclr/dlls/mscorrc/mscorrc.rc index 2dcd495c3fe61..2175566c10b61 100644 --- a/src/coreclr/dlls/mscorrc/mscorrc.rc +++ b/src/coreclr/dlls/mscorrc/mscorrc.rc @@ -497,18 +497,13 @@ BEGIN IDS_EE_OUT_OF_SYNCBLOCKS "Internal limitation: attempt to create more than 2^26 SyncBlocks." - IDS_EE_THREAD_NOTSTARTED "Thread has not been started." IDS_EE_STRING_TOOLONG "Marshaler restriction: Excessively long string." IDS_EE_VARARG_NOT_SUPPORTED "Vararg calling convention not supported." IDS_EE_INVALID_CA "Invalid custom attribute provided." - IDS_EE_THREADSTART_STATE "Thread is running or terminated; it cannot restart." IDS_EE_THREAD_CANNOT_GET "Unable to retrieve thread information." - IDS_EE_THREAD_DEAD_PRIORITY "Thread is dead; priority cannot be accessed." - IDS_EE_THREAD_PRIORITY_FAIL "Unable to set thread priority." - IDS_EE_THREAD_DEAD_STATE "Thread is dead; state cannot be accessed." IDS_EE_THREAD_BAD_STATE "Thread in invalid state." IDS_EE_THREAD_ABORT_WHILE_SUSPEND "Thread is suspended; attempting to abort." IDS_EE_NOVARIANTRETURN "PInvoke restriction: cannot return variants." @@ -574,8 +569,6 @@ BEGIN IDS_E_METHODACCESS "Attempt by method '%1' to access method '%2' failed.%3" IDS_E_TYPEACCESS "Attempt by method '%1' to access type '%2' failed.%3" - IDS_INVOKE_NULLREF_RETURNED "The target method returned a null reference." - IDS_EE_CANNOT_SET_INITONLY_STATIC_FIELD "Cannot set initonly static field '%1%' after type '%2' is initialized." END diff --git a/src/coreclr/dlls/mscorrc/resource.h b/src/coreclr/dlls/mscorrc/resource.h index 755af62718631..05b31799ec5c4 100644 --- a/src/coreclr/dlls/mscorrc/resource.h +++ b/src/coreclr/dlls/mscorrc/resource.h @@ -238,7 +238,6 @@ #define IDS_EE_STRUCTARRAYTOOLARGE 0x1a05 #define IDS_EE_BADMARSHALFIELD_NOSTRINGBUILDER 0x1a06 #define IDS_EE_NAME_UNKNOWN 0x1a07 -#define IDS_EE_THREAD_NOTSTARTED 0x1a0a #define IDS_EE_NO_BACKING_CLASS_FACTORY 0x1a0b #define IDS_EE_NAME_UNKNOWN_UNQ 0x1a0c #define IDS_EE_STRING_TOOLONG 0x1a0d @@ -246,11 +245,7 @@ #define IDS_EE_INVALID_CA 0x1a10 -#define IDS_EE_THREADSTART_STATE 0x1a12 - #define IDS_EE_THREAD_CANNOT_GET 0x1a15 -#define IDS_EE_THREAD_DEAD_PRIORITY 0x1a19 -#define IDS_EE_THREAD_DEAD_STATE 0x1a1a #define IDS_EE_THREAD_BAD_STATE 0x1a1b #define IDS_EE_THREAD_ABORT_WHILE_SUSPEND 0x1a1c @@ -294,8 +289,6 @@ #define IDS_CLASSLOAD_TYPEWRONGNUMGENERICARGS 0x1a4b #define IDS_CLASSLOAD_NSTRUCT_NEGATIVE_OFFSET 0x1a4d -#define IDS_EE_THREAD_PRIORITY_FAIL 0x1a4e - #define IDS_CLASSLOAD_INVALIDINSTANTIATION 0x1a59 #define IDS_EE_CLASSLOAD_INVALIDINSTANTIATION 0x1a59 @@ -586,8 +579,6 @@ #define IDS_EE_NDIRECT_GETPROCADDRESS_UNIX 0x2640 #define IDS_EE_ERROR_COM 0x2641 -#define IDS_INVOKE_NULLREF_RETURNED 0x2642 - #define IDS_EE_CANNOT_SET_INITONLY_STATIC_FIELD 0x2643 #define IDS_EE_NDIRECT_GETPROCADDR_WIN_DLL 0x2644 diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Augments/ReflectionAugments.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Augments/ReflectionAugments.cs index 211e3fbf16d4e..2e4e1679f10f3 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Augments/ReflectionAugments.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Augments/ReflectionAugments.cs @@ -105,8 +105,7 @@ internal static ReflectionCoreCallbacks ReflectionCoreCallbacks get { ReflectionCoreCallbacks callbacks = s_reflectionCoreCallbacks; - if (callbacks == null) - throw new InvalidOperationException(SR.InvalidOperation_TooEarly); + Debug.Assert(callbacks != null); return callbacks; } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Core/NonPortable/RuntimeTypeUnifier.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Core/NonPortable/RuntimeTypeUnifier.cs index dda21e7959784..5d901231448ce 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Core/NonPortable/RuntimeTypeUnifier.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Core/NonPortable/RuntimeTypeUnifier.cs @@ -112,7 +112,8 @@ public static Type GetRuntimeTypeBypassCache(EETypePtr eeType) } else { - throw new ArgumentException(SR.Arg_InvalidRuntimeTypeHandle); + Debug.Fail("Invalid RuntimeTypeHandle"); + throw new ArgumentException(SR.Arg_InvalidHandle); } } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Extensions/NonPortable/CustomAttributeInstantiator.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Extensions/NonPortable/CustomAttributeInstantiator.cs index 399a31119bf01..e06847e237dde 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Extensions/NonPortable/CustomAttributeInstantiator.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Extensions/NonPortable/CustomAttributeInstantiator.cs @@ -97,7 +97,7 @@ public static Attribute Instantiate(this CustomAttributeData cad) } Type? baseType = walk.BaseType; if (baseType == null) - throw new CustomAttributeFormatException(SR.Format(SR.CustomAttributeFormat_InvalidFieldFail, name)); + throw new CustomAttributeFormatException(SR.Format(SR.RFLCT_InvalidFieldFail, name)); walk = baseType; } } @@ -114,7 +114,7 @@ public static Attribute Instantiate(this CustomAttributeData cad) } Type? baseType = walk.BaseType; if (baseType == null) - throw new CustomAttributeFormatException(SR.Format(SR.CustomAttributeFormat_InvalidPropertyFail, name)); + throw new CustomAttributeFormatException(SR.Format(SR.RFLCT_InvalidPropFail, name)); walk = baseType; } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs index 13e4042887460..2cc2f40a841f8 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs @@ -135,7 +135,7 @@ public static unsafe Array NewMultiDimArray(RuntimeTypeHandle typeHandleForArray foreach (int lowerBound in lowerBounds) { if (lowerBound != 0) - throw new PlatformNotSupportedException(SR.Arg_NotSupportedNonZeroLowerBound); + throw new PlatformNotSupportedException(SR.PlatformNotSupported_NonZeroLowerBound); } } @@ -812,9 +812,8 @@ public static ReflectionExecutionDomainCallbacks Callbacks get { ReflectionExecutionDomainCallbacks callbacks = s_reflectionExecutionDomainCallbacks; - if (callbacks != null) - return callbacks; - throw new InvalidOperationException(SR.InvalidOperation_TooEarly); + Debug.Assert(callbacks != null); + return callbacks; } } @@ -831,9 +830,8 @@ internal static TypeLoaderCallbacks TypeLoaderCallbacks get { TypeLoaderCallbacks callbacks = s_typeLoaderCallbacks; - if (callbacks != null) - return callbacks; - throw new InvalidOperationException(SR.InvalidOperation_TooEarly); + Debug.Assert(callbacks != null); + return callbacks; } } @@ -842,9 +840,8 @@ internal static InteropCallbacks InteropCallbacks get { InteropCallbacks callbacks = s_interopCallbacks; - if (callbacks != null) - return callbacks; - throw new InvalidOperationException(SR.InvalidOperation_TooEarly); + Debug.Assert(callbacks != null); + return callbacks; } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ArrayHelpers.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ArrayHelpers.cs index a6a24bceded8f..35e2dd52cbc5c 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ArrayHelpers.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ArrayHelpers.cs @@ -54,7 +54,7 @@ public static unsafe Array NewObjArray(IntPtr pEEType, int nDimensions, int* pDi for (int i = 0; i < rank; i++) { if (pDimensions[2 * i] != 0) - throw new PlatformNotSupportedException(SR.Arg_NotSupportedNonZeroLowerBound); + throw new PlatformNotSupportedException(SR.PlatformNotSupported_NonZeroLowerBound); pDimensions[i] = pDimensions[2 * i + 1]; } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/TypeLoaderExceptionHelper.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/TypeLoaderExceptionHelper.cs index 38ac79b6f30ed..c3ca60ac9b7dc 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/TypeLoaderExceptionHelper.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/TypeLoaderExceptionHelper.cs @@ -88,8 +88,6 @@ private static string GetFormatString(ExceptionStringID id) return SR.InvalidProgram_Vararg; case ExceptionStringID.InvalidProgramCallVirtFinalize: return SR.InvalidProgram_CallVirtFinalize; - case ExceptionStringID.InvalidProgramUnmanagedCallersOnly: - return SR.InvalidProgram_UnmanagedCallersOnly; case ExceptionStringID.MissingField: return SR.EE_MissingField; case ExceptionStringID.MissingMethod: diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Resources/Strings.resx b/src/coreclr/nativeaot/System.Private.CoreLib/src/Resources/Strings.resx deleted file mode 100644 index 42df14c410ed4..0000000000000 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Resources/Strings.resx +++ /dev/null @@ -1,3265 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Name: - - - There are no context policies. - - - Default principal object cannot be set twice. - - - Ambiguous implementation found. - - - Cannot access member. - - - Attempted to read or write protected memory. This is often an indication that other memory is corrupt. - - - Error in the application. - - - Value does not fall within the expected range. - - - Specified argument was out of the range of valid values. - - - Overflow or underflow in the arithmetic operation. - - - Destination array is not long enough to copy all the items in the collection. Check array index and length. - - - Attempted to access an element as a type incompatible with the array. - - - Array must not be of length zero. - - - Format of the executable (.exe) or library (.dll) is invalid. - - - Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: '{0}'. - - - TimeSpan does not accept floating point Not-a-Number values. - - - String cannot contain a minus sign if the base is not 10. - - - The usage of IKeyComparer and IHashCodeProvider/IComparer interfaces cannot be mixed; use one or the other. - - - Attempt to unload the AppDomain failed. - - - Arrays must contain only blittable data in order to be copied to unmanaged memory. - - - Requested range extends past the end of the array. - - - Error HRESULT E_FAIL has been returned from a call to a COM component. - - - Error occurred during a cryptographic operation. - - - A datatype misalignment was detected in a load or store instruction. - - - Combination of arguments to the DateTime constructor is out of the legal range. - - - Attempted to access a path that is not on the disk. - - - Decimal byte array constructor requires an array of length four containing valid decimal bytes. - - - Attempted to load a type that was not created during ahead of time compilation. - - - Attempted to divide by zero. - - - Delegate to an instance method cannot have null 'this'. - - - Delegates must be of the same type. - - - Duplicate objects in argument. - - - This ExceptionHandlingClause is not a filter. - - - Object must be the same type as the enum. The type passed in was '{0}'; the enum type was '{1}'. - - - Entry point was not found. - - - Unable to find an entry point named '{0}' in DLL '{1}'. - - - Unable to find an entry point named '{0}' in DLL. - - - Illegal enum value: {0}. - - - Internal error in the runtime. - - - External component has thrown an exception. - - - Attempted to access a field that is not accessible by the caller. - - - One of the identified items was in an invalid format. - - - Byte array for GUID must be exactly {0} bytes long. - - - The number style AllowHexSpecifier is not supported on floating point data types. - - - Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table. - - - Index was outside the bounds of the array. - - - Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space. - - - Invalid Base. - - - Specified cast is not valid. - - - With the AllowHexSpecifier bit set in the enum bit field, the only other valid bits that can be combined into the enum value must be a subset of those in HexNumber. - - - Operation is not valid due to the current state of the object. - - - Not a legal OleAut date. - - - OleAut date did not convert to a DateTime correctly. - - - Invalid RuntimeTypeHandle. - - - I/O error occurred. - - - The given key was not present in the dictionary. - - - The given key '{0}' was not present in the dictionary. - - - Source string was not long enough. Check sourceIndex and count. - - - The arrays' lower bounds must be identical. - - - Attempted to access a non-existing field. - - - Attempt to access the method failed. - - - Attempted to access a missing member. - - - Attempted to access a missing method. - - - Attempted to add multiple callbacks to a delegate that does not support multicast. - - - Object must be of type Boolean. - - - Object must be of type Byte. - - - Object must be of type Char. - - - Object must be of type DateOnly. - {Locked="DateOnly"} - - - Object must be of type TimeOnly. - {Locked="TimeOnly"} - - - Object must be of type DateTime. - - - Object must be of type DateTimeOffset. - - - Object must be of type Decimal. - - - Object must be of type Double. - - - Drive name must be a root directory (i.e. 'C:\') or a drive letter ('C'). - - - Type provided must be an Enum. - - - Object must be of type GUID. - - - Object must be of type Int16. - - - Object must be of type Int32. - - - Object must be of type Int64. - - - Object must be of type IntPtr. - - - Object must be an array of primitives. - - - Object must be of type RuntimeAssembly. - - - Object must be of type SByte. - - - Object must be of type Single. - - - Method must be a static method. - - - Object must be of type String. - - - The pointer passed in as a String must not be in the bottom 64K of the process's address space. - - - Object must be of type TimeSpan. - - - Argument must be true. - - - Object must be of type UInt16. - - - Object must be of type UInt32. - - - Object must be of type UInt64. - - - Object must be of type UIntPtr. - - - Object must be of type Version. - - - Must provide at least one rank. - - - Array was not a one-dimensional array. - - - Array was not a two-dimensional array. - - - Array was not a three-dimensional array. - - - Argument count must not be negative. - - - Arg_NotFiniteNumberException = Number encountered was not a finite quantity. - - - The lower bound of target array must be zero. - - - Method may only be called on a Type for which Type.IsGenericParameter is true. - - - The method or operation is not implemented. - - - Specified method is not supported. - - - Arrays with non-zero lower bounds are not supported. - - - Object reference not set to an instance of an object. - - - Object of type '{0}' cannot be converted to type '{1}'. - - - Arithmetic operation resulted in an overflow. - - - Insufficient memory to continue the execution of the program. - - - Operation is not supported on this platform. - - - Parameter name: {0} - - - The path is empty. - - - The UNC path '{0}' should be of the form \\\\server\\share. - - - Attempted to operate on an array with the incorrect number of dimensions. - - - Indices length does not match the array rank. - - - Only single dimensional arrays are supported for the requested action. - - - The specified arrays must have the same number of dimensions. - - - Number of lengths and lowerBounds must match. - - - RegistryKey.GetValue does not allow a String that has a length greater than Int32.MaxValue. - - - The specified registry key does not exist. - - - Specified array was not of the expected rank. - - - Specified array was not of the expected type. - - - Security error. - - - Operation caused a stack overflow. - - - Object synchronization method was called from an unsynchronized block of code. - - - System error. - - - Exception has been thrown by the target of an invocation. - - - Number of parameters specified does not match the expected number. - - - Missing parameter does not have a default value. - - - Thread failed to start. - - - Thread was in an invalid state for the operation being executed. - - - The operation has timed out. - - - Attempt to access the type failed. - - - Failure has occurred while loading a type. - - - Attempted to perform an unauthorized operation. - - - Version string portion was too short or too long. - - - The value '{0}' is not of type '{1}' and cannot be used in this generic collection. - - - Absolute path information is required. - - - An item with the same key has already been added. - - - Item has already been added. Key in dictionary: '{0}' Key being added: '{1}' - - - An item with the same key has already been added. Key: {0} - - - The AdjustmentRule array cannot contain null elements. - - - The elements of the AdjustmentRule array must be in chronological order and must not overlap. - - - The alignment must be a power of two. - - - Attribute names must be unique. - - - Format specifier was invalid. - - - {0} is not a supported code page. - - - CompareOption.Ordinal cannot be used with other options. - - - The DateTimeStyles value RoundtripKind cannot be used with the values AssumeLocal, AssumeUniversal or AdjustToUniversal. - - - The DateTimeStyles values AssumeLocal and AssumeUniversal cannot be used together. - - - Conversion buffer overflow. - - - The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly. For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local. - - - {0} is an invalid culture identifier. - - - Culture IETF Name {0} is not a recognized IETF name. - - - Culture ID {0} (0x{0:X4}) is a neutral culture; a region cannot be created from it. - - - Culture is not supported. - - - Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. - - - Customized cultures cannot be passed by LCID, only by name. - - - The binary data must result in a DateTime with ticks between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. - - - The supplied DateTime must have the Year, Month, and Day properties set to 1. The time cannot be specified more precisely than whole milliseconds. - - - The supplied DateTime includes a TimeOfDay setting. This is not supported. - - - The supplied DateTime represents an invalid time. For example, when the clock is adjusted forward, any time in the period that is skipped is invalid. - - - The supplied DateTime is not in an ambiguous time range. - - - The supplied DateTime must have the Kind property set to DateTimeKind.Unspecified. - - - The supplied DateTime must have the Kind property set to DateTimeKind.Unspecified or DateTimeKind.Utc. - - - The DateTimeStyles value 'NoCurrentDateDefault' is not allowed when parsing DateTimeOffset. - - - The supplied DateTimeOffset is not in an ambiguous time range. - - - Decimal separator cannot be the empty string. - - - Empty file name is not legal. - - - Empty name is not legal. - - - Waithandle array may not be empty. - - - Must complete Convert() operation or call Encoder.Reset() before calling GetBytes() or GetByteCount(). Encoder '{0}' fallback '{1}'. - - - The output byte buffer is too small to contain the encoded data, encoding '{0}' fallback '{1}'. - - - The output char buffer is too small to contain the decoded characters, encoding '{0}' fallback '{1}'. - - - '{0}' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. - - - The argument type, '{0}', is not the same as the enum type '{1}'. - - - Cannot change fallback when buffer is not empty. Previous Convert() call left data in the fallback buffer. - - - At least one object must implement IComparable. - - - Type of argument is not compatible with the generic comparer. - - - Length of the array must be {0}. - - - Target array type is not compatible with the type of items in the collection. - - - Not a valid calendar for the given culture. - - - Invalid Unicode code point found at index {0}. - - - String contains invalid Unicode code points. - - - Unable to translate bytes {0} at index {1} from specified code page to Unicode. - - - Unable to translate Unicode character \\u{0:X4} at index {1} to specified code page. - - - Culture name '{0}' is not supported. - - - Culture name '{0}' is not a predefined culture. - - - Invalid DateTimeKind value. - - - An undefined DateTimeStyles value is being used. - - - The only allowed values for the styles are AllowWhiteSpaces, AllowTrailingWhite, AllowLeadingWhite, and AllowInnerWhite. - {Locked="AllowWhiteSpaces, AllowTrailingWhite, AllowLeadingWhite, and AllowInnerWhite"} - - - The DigitSubstitution property must be of a valid member of the DigitShapes enumeration. Valid entries include Context, NativeNational or None. - - - Invalid element name '{0}'. - - - Invalid element tag '{0}'. - - - Invalid element text '{0}'. - - - Invalid element value '{0}'. - - - The value '{0}' is not valid for this usage of the type {1}. - - - Value of flags is invalid. - - - Every element in the value array should be between one and nine, except for the last element, which can be zero. - - - Found a high surrogate char without a following low surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters. - - - The specified ID parameter '{0}' is not supported. - - - Found a low surrogate char without a preceding high surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters. - - - The NativeDigits array must contain exactly ten members. - - - Each member of the NativeDigits array must be a single text element (one or more UTF16 code points) with a Unicode Nd (Number, Decimal Digit) property indicating it is a digit. - - - The region name {0} should not correspond to neutral culture; a specific culture name is required. - - - Invalid normalization form. - - - An undefined NumberStyles value is being used. - - - Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection. - - - Illegal characters in path. - - - The REG_TZI_FORMAT structure is corrupt. - - - The given culture name '{0}' cannot be used to locate a resource file. Resource filenames must consist of only letters, numbers, hyphens or underscores. - - - The specified serialized string '{0}' is not supported. - - - An undefined TimeSpanStyles value is being used. - - - Argument must be initialized to false - - - Assembly must be a runtime Assembly object. - - - Type must be a runtime Type object. - - - The specified structure '{0}' must be blittable or have layout information. - - - The specified object must not be an instance of a generic type. - - - The specified Type must not be a generic type definition. - - - No Era was supplied. - - - There is no region associated with the Invariant Culture (Culture ID: 0x7F). - - - Object contains non-primitive or non-blittable data. - - - Path cannot be the empty string or all whitespace. - - - Array size exceeds addressing limitations. - - - The UTC Offset of the local dateTime parameter does not match the offset argument. - - - Offset must be specified in whole minutes. - - - Offset must be within plus or minus 14 hours. - - - The UTC Offset for Utc DateTime instances must be 0. - - - Culture name {0} or {1} is not supported. - - - Only mscorlib's assembly is valid. - - - The DateStart property must come before the DateEnd property. - - - Number was less than the array's lower bound in the first dimension. - - - Arrays larger than 2GB are not supported. - - - Index was out of range. Must be non-negative and less than the size of the collection. - - - The specified length exceeds maximum capacity of SecureString. - - - The specified length exceeds the maximum value of {0}. - - - Argument must be less than or equal to 2^31 - 1 milliseconds. - - - Non-negative number required. - - - The ID parameter must be in the range {0} through {1}. - - - The name of the type is invalid. - - - The format of the path '{0}' is not supported. - - - Recursive fallback not allowed for character \\u{0:X4}. - - - Recursive fallback not allowed for bytes {0}. - - - The result is out of the supported range for this calendar. The result should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive. - - - The initial count for the semaphore must be greater than or equal to zero and less than the maximum count. - - - The structure must not be a value class. - - - The TimeSpan parameter cannot be specified more precisely than whole minutes. - - - The time zone ID '{0}' was not found on the local computer. - - - The tzfile does not begin with the magic characters 'TZif'. Please verify that the file is not corrupt. - - - The TZif data structure is corrupt. - - - fromInclusive must be less than or equal to toExclusive. - - - The DaylightTransitionStart property must not equal the DaylightTransitionEnd property. - - - The type must not be imported from COM. - - - The UTC time represented when the offset is applied must be between year 0 and 10,000. - - - The name can be no more than {0} characters in length. - - - The object is not an array with the same number of elements as the array to compare it to. - - - Argument must be of type {0}. - - - The last element of an eight element tuple must be a Tuple. - - - Argument must be of type {0}. - - - The last element of an eight element ValueTuple must be a ValueTuple. - - - Array cannot be null. - - - At least one element in the specified array was null. - - - Found a null value within an array. - - - Cannot have a null child. - - - Collection cannot be null. - - - Dictionary cannot be null. - - - File name cannot be null. - - - Value cannot be null. - - - Key cannot be null. - - - String reference not set to an instance of a String. - - - Type cannot be null. - - - The waitHandles parameter cannot be null. - - - Value to add was out of range. - - - Actual value was {0}. - - - Year, Month, and Day parameters describe an un-representable DateTime. - - - Hour, Minute, and Second parameters describe an un-representable DateTime. - - - Must be less than or equal to the size of the collection. - - - Argument must be between {0} and {1}. - - - Specified time is not supported in this calendar. It should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive. - - - Capacity exceeds maximum capacity. - - - Count must be positive and count must refer to a location within the string/array/collection. - - - The added or subtracted value results in an un-representable DateTime. - - - Months value must be between +/-120000. - - - Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. - - - Ticks must be between 0 and and TimeOnly.MaxValue.Ticks. - - - Years value must be between +/-10000. - - - Day must be between 1 and {0} for month {1}. - - - The DayOfWeek enumeration must be in the range 0 through 6. - - - The Day parameter must be in the range 1 through 31. - - - Decimal can only round to between 0 and 28 digits of precision. - - - Decimal's scale value must be between 0 and 28, inclusive. - - - endIndex cannot be greater than startIndex. - - - Enum value was out of legal range. - - - Time value was out of era range. - - - Not a valid Win32 FileTime. - - - Value must be positive. - - - Too many characters. The resulting number of bytes is larger than what can be returned as an int. - - - Too many bytes. The resulting number of chars is larger than what can be returned as an int. - - - Load factor needs to be between 0.1 and 1.0. - - - Index and count must refer to a location within the string. - - - Index and count must refer to a location within the buffer. - - - Index and length must refer to a location within the string. - - - Index was out of range. Must be non-negative and less than the length of the string. - - - Input is too large to be processed. - - - Era value was not valid. - - - A valid high surrogate character is between 0xd800 and 0xdbff, inclusive. - - - A valid low surrogate character is between 0xdc00 and 0xdfff, inclusive. - - - A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff). - - - The length cannot be greater than the capacity. - - - Index must be within the bounds of the List. - - - Index was out of range. Must be non-negative and less than the size of the list. - - - Index was out of range. Must be non-negative and less than the size of the list. - - - Month must be between one and twelve. - - - Day number must be between 0 and DateOnly.MaxValue.DayNumber. - {Locked="DateOnly.MaxValue.DayNumber"} - - - The Month parameter must be in the range 1 through 12. - - - Value must be non-negative and less than or equal to Int32.MaxValue. - - - '{0}' must be non-negative. - - - '{0}' must be greater than zero. - - - Number must be either non-negative and less than or equal to Int32.MaxValue or -1. - - - Positive number required. - - - Capacity must be positive. - - - Count cannot be less than zero. - - - Length cannot be less than zero. - - - lohSize can't be greater than totalSize - - - Offset and length must refer to a position in the string. - - - Either offset did not refer to a position in the string, or there is an insufficient length of destination character array. - - - Pointer startIndex and length do not refer to a valid string. - - - Valid values are between {0} and {1}, inclusive. - - - Rounding digits must be between 0 and 15, inclusive. - - - Rounding digits must be between 0 and 6, inclusive. - - - capacity was less than the current size. - - - MaxCapacity must be one or greater. - - - StartIndex cannot be less than zero. - - - startIndex cannot be larger than length of string. - - - startIndex must be less than length of string. - - - The TimeSpan parameter must be within plus or minus 14.0 hours. - - - The sum of the BaseUtcOffset and DaylightDelta properties must within plus or minus 14.0 hours. - - - Version's parameters must be greater than or equal to zero. - - - The Week parameter must be in the range 1 through 5. - - - Year must be between 1 and 9999. - - - Function does not accept floating point Not-a-Number values. - - - Source array type cannot be assigned to destination array type. - - - Cannot unload non-collectible AssemblyLoadContext. - - - Unload called on AssemblyLoadContext that is unloading or that was already unloaded. - - - AssemblyLoadContext is unloading or was already unloaded. - - - Could not load file or assembly '{0}'. An attempt was made to load a program with an incorrect format. - - - A resolver is already set for the assembly. - - - A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted. - - - This range in the underlying list is invalid. A possible cause is that elements were removed. - - - --- End of inner exception stack trace --- - - - --- End of stack trace from previous location --- - - - Exception of type '{0}' was thrown. - - - The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. - - - Invalid length for a Base-64 char array or string. - - - String was not recognized as a valid Boolean. - - - Format specifier '{0}' was invalid. - - - No format specifiers were provided. - - - The input is not a valid hex string as it contains a non-hex character. - - - The input is not a valid hex string as its length is not a multiple of 2. - - - Cannot find a matching quote character for the character '{0}'. - - - Input string was either empty or contained only whitespace. - - - Expected 0x prefix. - - - Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). - - - Guid string should only contain hexadecimal characters. - - - Expected {0xdddddddd, etc}. - - - Could not find a comma, or the length between the previous token and the comma was zero (i.e., '0x,'etc.). - - - Could not find a brace, or the length between the previous token and the brace was zero (i.e., '0x,'etc.). - - - Dashes are in the wrong position for GUID parsing. - - - Could not find the ending brace. - - - Additional non-parsable characters are at the end of the string. - - - Unrecognized Guid format. - - - Index (zero based) must be greater than or equal to zero and less than the size of the argument list. - - - Format String can be only 'D', 'd', 'N', 'n', 'P', 'p', 'B', 'b', 'X' or 'x'. - - - Input string was not in a correct format. - - - String must be exactly one character long. - - - Could not find any recognizable digits. - - - String was not recognized as a valid TimeSpan. - - - Insufficient available memory to meet the expected demands of an operation at this time. Please try again later. - - - Insufficient memory to meet the expected demands of an operation, and this system is likely to never satisfy this request. If this is a 32 bit system, consider booting in 3 GB mode. - - - Insufficient available memory to meet the expected demands of an operation at this time, possibly due to virtual address space fragmentation. Please try again later. - - - Cannot marshal: Encountered unmappable character. - - - Null object cannot be converted to a value type. - - - At least one element in the source array could not be cast down to the destination array type. - - - Invalid cast from '{0}' to '{1}'. - - - Object must implement IConvertible. - - - Object cannot be stored in an array of this type. - - - WinRT Interop has already been initialized and cannot be initialized again. - - - Internal Error in DateTime and Calendar operations. - - - Enumeration already finished. - - - Collection was modified; enumeration operation may not execute. - - - Enumeration has not started. Call MoveNext. - - - Enumeration has either not started or has already finished. - - - OSVersion's call to GetVersionEx failed. - - - Handle is not initialized. - - - Handle is not pinned. - - - Hashtable insert failed. Load factor too high. The most common cause is multiple threads writing to the Hashtable simultaneously. - - - Failed to compare two elements in the array. - - - Nullable object must have a value. - - - The underlying array is null. - - - Cannot pack a packed Overlapped again. - - - Instance is read-only. - - - The thread was created with a ThreadStart delegate that does not accept a parameter. - - - Unknown enum type. - - - This property has already been set and cannot be modified. - - - Array.CreateInstance() can only accept Type objects created by the runtime. - - - Internal Error: This operation cannot be invoked in an eager class constructor. - - - Cannot call Set on a null context - - - AsyncFlowControl object must be used on the thread where it was created. - - - Cannot restore context flow when it is not suppressed. - - - Context flow is already suppressed. - - - AsyncFlowControl object can be used only once to call Undo(). - - - AsyncFlowControl objects can be used to restore flow only on a Context that had its flow suppressed. - - - The stream is currently in use by a previous operation on the stream. - - - Common Language Runtime detected an invalid program. - - - Common Language Runtime detected an invalid program. The body of method '{0}' is invalid. - - - Method '{0}' has a variable argument list. Variable argument lists are not supported in .NET Core. - - - Object.Finalize() can not be called directly. It is only callable by the runtime. - - - UnmanagedCallersOnly method cannot be called from managed code. - - - The time zone ID '{0}' was found on the local computer, but the registry information was corrupt. - - - The time zone ID '{0}' was found on the local computer, but the file at '{1}' was corrupt. - - - Invalid Julian day in POSIX strings. - - - Julian n day in POSIX strings is not supported. - - - There are no ttinfo structures in the tzfile. At least one ttinfo structure is required in order to construct a TimeZoneInfo object. - - - '{0}' is not a valid POSIX-TZ-environment-variable MDate rule. A valid rule has the format 'Mm.w.d'. - - - Could not find the drive '{0}'. The drive might not be ready or might not be mapped. - - - The file '{0}' already exists. - - - File name: '{0}' - - - Unable to find the specified file. - - - Could not load file or assembly '{0}'. The system cannot find the file specified. - - - Could not load the specified file. - - - Could not load the file '{0}'. - - - Could not find a part of the path. - - - Could not find a part of the path '{0}'. - - - The specified file name or path is too long, or a component of the specified path is too long. - - - The path '{0}' is too long, or a component of the specified path is too long. - - - Too many levels of symbolic links in '{0}'. - - - The process cannot access the file '{0}' because it is being used by another process. - - - The process cannot access the file because it is being used by another process. - - - Cannot create '{0}' because a file or directory with the same name already exists. - - - Failed to create '{0}' with allocation size '{1}' because the disk was full. - - - Failed to create '{0}' with allocation size '{1}' because the file was too large. - - - Access to the path is denied. - - - Access to the path '{0}' is denied. - - - The lazily-initialized type does not have a public, parameterless constructor. - - - The mode argument specifies an invalid value. - - - ValueFactory returned null. - - - Value is not created. - - - ValueFactory attempted to access the Value property of this instance. - - - Constructor on type '{0}' not found. - - - An assembly (probably '{1}') must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.{0} and the CONTRACTS_FULL symbol is defined. Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild. CCRewrite can be downloaded from http://go.microsoft.com/fwlink/?LinkID=169180. \r\nAfter the rewriter is installed, it can be enabled in Visual Studio from the project's Properties page on the Code Contracts pane. Ensure that 'Perform Runtime Contract Checking' is enabled, which will define CONTRACTS_FULL. - - - Collection was of a fixed size. - - - The number of WaitHandles must be less than or equal to 64. - - - The number of WaitHandles on a STA thread must be less than or equal to 63. - - - No data is available for encoding {0}. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. - - - Function not marked with UnmanagedCallersOnlyAttribute. - - - Collection is read-only. - - - The specified operation is not supported on Ranges. - - - The string comparison type passed in is currently not supported. - - - Arrays of System.Void are not supported. - - - Cannot create boxed ByRef-like values. - - - Type is not supported. - - - WaitAll for multiple handles on a STA thread is not supported. - - - Overlapped I/O is not supported. - - - Cannot access a disposed object. - - - Object name: '{0}'. - - - Safe handle has been closed. - - - Value was either too large or too small for an unsigned byte. - - - Value was either too large or too small for a character. - - - Value was either too large or too small for a Decimal. - - - Value was either too large or too small for a Double. - - - The TimeSpan could not be parsed because at least one of the numeric components is out of range or contains too many digits. - - - The duration cannot be returned for TimeSpan.MinValue because the absolute value of TimeSpan.MinValue exceeds the value of TimeSpan.MaxValue. - - - Value was either too large or too small for an Int16. - - - Value was either too large or too small for an Int32. - - - Value was either too large or too small for an Int64. - - - Negating the minimum value of a twos complement number is invalid. - - - The string was being parsed as an unsigned number and could not have a negative sign. - - - Value was either too large or too small for a signed byte. - - - Value was either too large or too small for a Single. - - - TimeSpan overflowed because the duration is too long. - - - Value was either too large or too small for a UInt16. - - - Value was either too large or too small for a UInt32. - - - Value was either too large or too small for a UInt64. - - - Only single dimension arrays are supported here. - - - An object that does not derive from System.Exception has been wrapped in a RuntimeWrappedException. - - - The condition argument is null. - - - The value of the field '{0}' is invalid. The serialized data is corrupt. - - - An error occurred while deserializing the object. The serialized data is corrupt. - - - The serialized data contained an invalid escape sequence '\\{0}'. - - - Only system-provided types can be passed to the GetUninitializedObject method. '{0}' is not a valid instance of a type. - - - The timeout must represent a value between -1 and Int32.MaxValue, inclusive. - - - The wait completed due to an abandoned mutex. - - - Adding the specified count to the semaphore would cause it to exceed its maximum count. - - - Thread was interrupted from a waiting state. - - - No handle of the given name exists. - - - A WaitHandle with system-wide name '{0}' cannot be created. A WaitHandle of a different type might have the same name. - - - The WaitHandle cannot be signaled because it would exceed its maximum count. - - - The time zone ID '{0}' was not found on the local computer. - - - Type constructor threw an exception. - - - The type initializer for '{0}' threw an exception. - - - A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property. - - - Operation could destabilize the runtime. - - - Enum underlying type and the object must be same type or object. Type passed in was '{0}'; the enum underlying type was '{1}'. - - - Format String can be only 'G', 'g', 'X', 'x', 'F', 'f', 'D' or 'd'. - - - The value passed in must be an enum base or an underlying type for an enum, such as an Int32. - - - Enum underlying type and the object must be same type or object must be a String. Type passed in was '{0}'; the enum underlying type was '{1}'. - - - Type must be a type provided by the runtime. - - - Must specify valid information for parsing in the string. - - - Requested value '{0}' was not found. - - - Destination array was not long enough. Check the destination index, length, and the array's lower bounds. - - - Source array was not long enough. Check the source index, length, and the array's lower bounds. - - - String cannot be of zero length. - - - The first char in the string is the null character. - - - Environment variable name or value is too long. - - - Environment variable name cannot contain equal character. - - - Assumption failed. - - - Assumption failed: {0} - - - Assertion failed. - - - Assertion failed: {0} - - - Precondition failed. - - - Precondition failed: {0} - - - Postcondition failed. - - - Postcondition failed: {0} - - - Postcondition failed after throwing an exception. - - - Postcondition failed after throwing an exception: {0} - - - The home directory of the current user could not be determined. - - - Invariant failed. - - - Invariant failed: {0} - - - Could not find a resource entry for the encoding codepage '{0} - {1}' - - - Unicode - - - Unicode (Big-Endian) - - - Unicode (UTF-32) - - - Unicode (UTF-32 Big-Endian) - - - US-ASCII - - - Western European (ISO) - - - Unicode (UTF-7) - - - Unicode (UTF-8) - - - ---- DEBUG ASSERTION FAILED ---- - - - ---- Assert Long Message ---- - - - ---- Assert Short Message ---- - - - Object cannot be cast to Empty. - - - Unknown TypeCode value. - - - Could not determine the order of year, month, and date from '{0}'. - - - String '{0}' was not recognized as a valid DateTime. - - - String '{0}' was not recognized as a valid DateOnly. - {Locked="DateOnly"} - - - String '{0}' was not recognized as a valid TimeOnly. - {Locked="TimeOnly"} - - - String '{0}' contains parts which are not specific to the {1}. - - - The DateTime represented by the string '{0}' is not supported in calendar '{1}'. - - - String '{0}' was not recognized as a valid DateTime because the day of week was incorrect. - - - The DateTime represented by the string '{0}' is out of range. - - - There must be at least a partial date with a year present in the input string '{0}'. - - - The time zone offset of string '{0}' must be within plus or minus 14 hours. - - - DateTime pattern '{0}' appears more than once with different values. - - - The string '{0}' was not recognized as a valid DateTime. There is an unknown word starting at index '{1}'. - - - The UTC representation of the date '{0}' falls outside the year range 1-9999. - - - Ambiguous match found. - - - One or more errors occurred. - - - An element of innerExceptions was null. - - - The serialization stream contains no inner exceptions. - - - (Inner Exception #{0}) - This text is prepended to each inner exception description during aggregate exception formatting - - - Time-out interval must be less than 2^32-2. - - - Period must be less than 2^32-2. - - - The current SynchronizationContext may not be used as a TaskScheduler. - - - ExecuteTask may not be called for a task which was previously queued to a different TaskScheduler. - - - The TryExecuteTaskInline call to the underlying scheduler succeeded, but the task body was not invoked. - - - An exception was thrown by a TaskScheduler. - - - It is invalid to exclude specific continuation kinds for continuations off of multiple tasks. - - - The specified TaskContinuationOptions combined LongRunning and ExecuteSynchronously. Synchronous continuations should not be long running. - - - The tasks argument contains no tasks. - - - The tasks argument included a null value. - - - It is invalid to specify TaskCreationOptions.PreferFairness in calls to FromAsync. - - - It is invalid to specify TaskCreationOptions.LongRunning in calls to FromAsync. - - - The builder was not properly initialized. - - - An attempt was made to transition a task to a final state when it had already completed. - - - {Not yet computed} - - - The operation was canceled. - - - No tokens were supplied. - - - The CancellationTokenSource has been disposed. - - - The CancellationTokenSource associated with this CancellationToken has been disposed. - - - (Internal)Expected an Exception or an IEnumerable<Exception> - - - A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. - - - The value needs to be either -1 (signifying an infinite timeout), 0 or a positive integer. - - - The value needs to translate in milliseconds to -1 (signifying an infinite timeout), 0 or a positive integer less than or equal to Int32.MaxValue. - - - A task may only be disposed if it is in a completion state (RanToCompletion, Faulted or Canceled). - - - The tasks array included at least one null element. - - - The specified TaskContinuationOptions excluded all continuation kinds. - - - The value needs to translate in milliseconds to -1 (signifying an infinite timeout), 0, or a positive integer less than or equal to the maximum allowed timer duration. - - - RunSynchronously may not be called on a task that was already started. - - - The task has been disposed. - - - RunSynchronously may not be called on a task that has already completed. - - - RunSynchronously may not be called on a task not bound to a delegate, such as the task returned from an asynchronous method. - - - RunSynchronously may not be called on a continuation task. - - - Start may not be called on a task that was already started. - - - Start may not be called on a continuation task. - - - Start may not be called on a promise-style task. - - - Start may not be called on a task that has completed. - - - A task was canceled. - - - The exceptions collection was empty. - - - The exceptions collection included at least one null element. - - - '{0}' cannot be greater than {1}. - - - An exception was not handled in an AsyncLocal<T> notification callback. - - - Either the IAsyncResult object did not come from the corresponding async method on this type, or the End method was called multiple times with the same IAsyncResult. - - - Thread tracking is disabled. - - - The calling thread already holds the lock. - - - The calling thread does not hold the lock. - - - The tookLock argument must be set to false before calling this method. - - - The timeout must be a value between -1 and Int32.MaxValue, inclusive. - - - The event has been disposed. - - - The spinCount argument must be in the range 0 to {0}, inclusive. - - - There are too many threads currently waiting on the event. A maximum of {0} waiting threads are supported. - - - Send is not supported in the Windows Runtime SynchronizationContext - - - The semaphore has been disposed. - - - The releaseCount argument must be greater than zero. - - - The timeout must represent a value between -1 and Int32.MaxValue, inclusive. - - - The maximumCount argument must be a positive number. If a maximum is not required, use the constructor without a maxCount parameter. - - - The initialCount argument must be non-negative and less than or equal to the maximumCount. - - - The ThreadLocal object is not tracking values. To use the Values property, use a ThreadLocal constructor that accepts the trackAllValues parameter and set the parameter to true. - - - ValueFactory attempted to access the Value property of this instance. - - - The ThreadLocal object has been disposed. - - - Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock. - - - Recursive write lock acquisitions not allowed in this mode. - - - A read lock may not be acquired with the write lock held in this mode. - - - Recursive upgradeable lock acquisitions not allowed in this mode. - - - Recursive read lock acquisitions not allowed in this mode. - - - The lock is being disposed while still being used. It either is being held by a thread and/or has active waiters waiting to acquire the lock. - - - The write lock is being released without being held. - - - Upgradeable lock may not be acquired with read lock held. - - - Upgradeable lock may not be acquired with write lock held in this mode. Acquiring Upgradeable lock gives the ability to read along with an option to upgrade to a writer. - - - The upgradeable lock is being released without being held. - - - The read lock is being released without being held. - - - Timeouts are not supported on this stream. - - - The Timer was already closed using an incompatible Dispose method. - - - Stream does not support reading. - - - Stream does not support writing. - - - Cannot access a closed Stream. - - - Derived classes must provide an implementation. - - - Cannot remove the event handler since no public remove method exists for the event. - - - Cannot add the event handler since no public add method exists for the event. - - - Serialization error. - - - Member '{0}' was not found. - - - Version value must be positive. - - - Cannot add the same member twice to a SerializationInfo object. - - - This non-CLS method is not implemented. - - - Cannot resolve {0} to a TypeInfo object. - - - Binary format of the specified custom attribute was invalid. - - - The member must be either a field or a property. - - - Specified filter criteria was invalid. - - - Attempt has been made to use a COM object that does not have a backing class factory. - - - Specified OLE variant was invalid. - - - Must specify one or more parameters. - - - Type must be a Pointer. - - - Invalid handle. - - - The Enum type should contain one and only one instance field. - - - Type passed in must be derived from System.Attribute or System.Attribute itself. - - - A String must be provided for the filter criteria. - - - An Int32 must be provided for the filter criteria. - - - Adding or removing event handlers dynamically is not supported on WinRT events. - - - COM Interop is not supported on this platform. - - - ReflectionOnly loading is not supported on this platform. - - - Locking/unlocking file regions is not supported on this platform. Use FileShare on the entire file instead. - - - This API is specific to the way in which Windows handles asynchronous I/O, and is not supported on this platform. - - - Dynamic code generation is not supported on this platform. - - - Secondary AppDomains are not supported on this platform. - - - Code Access Security is not supported on this platform. - - - AppDomain resource monitoring is not supported on this platform. - - - Windows Principal functionality is not supported on this platform. - - - Thread abort is not supported on this platform. - - - Thread suspend is not supported on this platform. - - - Member '{0}' not found. - - - Method '{0}' not found. - - - Field '{0}' not found. - - - String cannot have zero length. - - - Failed to get marshaler for IID {0}. - - - The time zone ID '{0}' was found on the local computer, but the application does not have permission to read the file. - - - The time zone ID '{0}' was found on the local computer, but the application does not have permission to read the registry information. - - - Invalid assembly public key. - - - Requested registry access is not allowed. - - - Could not load type '{0}' from assembly '{1}'. - - - '{0}' from assembly '{1}' has too many dimensions. - - - Could not load type '{0}' from assembly '{1}' because generic types cannot have explicit layout. - - - Could not load type '{0}' from assembly '{1}' because the format is invalid. - - - Array of type '{0}' from assembly '{1}' cannot be created because base value type is too large. - - - Could not load type '{0}' from assembly '{1}' because it contains an object field at offset '{2}' that is incorrectly aligned or overlapped by a non-object field. - - - Method not found: '{0}'. - - - Field not found: '{0}'. - - - Access to the registry key '{0}' is denied. - - - Unknown error '{0}'. - - - The specified Type must be a struct containing no references. - - - Buffer cannot be null. - - - The number of bytes cannot exceed the virtual address space on a 32 bit machine. - - - The length of the buffer must be less than the maximum UIntPtr value for your platform. - - - Not enough space available in the buffer. - - - You must call Initialize on this object instance before using it. - - - The buffer is not associated with this pool and may not be returned to it. - - - Offset and length were greater than the size of the SafeBuffer. - - - Invalid seek origin. - - - There are not enough bytes remaining in the accessor to read at this position. - - - There are not enough bytes remaining in the accessor to write at this position. - - - Offset and capacity were greater than the size of the view. - - - UnmanagedMemoryStream length must be non-negative and less than 2^63 - 1 - baseAddress. - - - The UnmanagedMemoryAccessor capacity and offset would wrap around the high end of the address space. - - - Stream length must be non-negative and less than 2^31 - 1 - origin. - - - The UnmanagedMemoryStream capacity would wrap around the high end of the address space. - - - The method cannot be called twice on the same instance. - - - Unable to expand length of this stream beyond its capacity. - - - An attempt was made to move the position before the beginning of the stream. - - - Stream was too long. - - - Read an invalid decimal value from the buffer. - - - Accessor does not support reading. - - - This operation is not supported for an UnmanagedMemoryStream created from a SafeBuffer. - - - Accessor does not support writing. - - - Stream does not support seeking. - - - Unmanaged memory stream position was beyond the capacity of the stream. - - - ArrayWithOffset: offset exceeds array size. - - - Cannot access a closed accessor. - - - The position may not be greater or equal to the capacity of the accessor. - - - Unable to read beyond the end of the stream. - - - Attempted to read past the end of the stream. - - - Cannot access a closed file. - - - Search pattern '{0}' cannot contain ".." to move up directories and can be contained only internally in file/directory names, as in "a..b". - - - Specified file length was too large for the file system. - - - 'handle' has been disposed or is an invalid handle. - - - 'handle' has already been bound to the thread pool, or was not opened for asynchronous I/O. - - - 'preAllocated' is already in use. - - - 'overlapped' has already been freed. - - - 'overlapped' was not allocated by this ThreadPoolBoundHandle instance. - - - Handle does not support asynchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened synchronously (that is, it was not opened for overlapped I/O). - - - Path cannot be null. - - - SafeHandle cannot be null. - - - Empty path name is not legal. - - - Append access can be requested only in write-only mode. - - - Preallocation size can be requested only in write mode. - - - Preallocation size can be requested only for new files. - - - Combining FileMode: {0} with FileAccess: {1} is invalid. - - - [Unknown] - - - The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss. - - - The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size. - - - IO operation will not work. Most likely the file will become too long. - - - IO operation will not work. Most likely the file will become too long or the handle was not opened to support synchronous IO operations. - - - FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:', call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr. - - - BindHandle for ThreadPool failed on this handle. - - - The link's file system entry type is inconsistent with that of its target: {0} - - - Handle does not support synchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened asynchronously (that is, it was opened explicitly for overlapped I/O). - - - Unable to truncate data that previously existed in a file opened in Append mode. - - - Unable seek backward to overwrite data that previously existed in a file opened in Append mode. - - - The ResourceReader class does not know how to read this version of .resources files. - - - Stream is not a valid resource file. - - - Corrupt .resources file. Unable to read resources from this file because of invalid header information. Try regenerating the .resources file. - - - Stream was not readable. - - - Corrupt .resources file. String length must be non-negative. - - - Corrupt .resources file. The Invalid offset into name section is . - - - Corrupt .resources file. The specified type doesn't match the available data in the stream. - - - Corrupt .resources file. The resource name for name index that extends past the end of the stream is - - - Corrupt .resources file. Invalid offset into data section is - - - Too many bytes in what should have been a 7-bit encoded integer. - - - Corrupt .resources file. The specified type doesn't exist. - - - ResourceReader is closed. - - - Unable to find manifest resource. - - - The keys for this dictionary are missing. - - - One of the serialized keys is null. - - - Mutating a key collection derived from a dictionary is not allowed. - - - Mutating a value collection derived from a dictionary is not allowed. - - - MemoryStream's internal buffer cannot be accessed. - - - Memory stream is not expandable. - - - Stream cannot be null. - - - BinaryReader encountered an invalid string length of {0} characters. - - - The number of bytes requested does not fit into BinaryReader's internal buffer. - - - Insufficient state to deserialize the object. Missing field '{0}'. - - - The UnitySerializationHolder object is designed to transmit information about other types and is not serializable itself. - - - The given module {0} cannot be found within the assembly {1}. - - - Invalid Unity type. - - - The handle is invalid. - - - The named version of this synchronization primitive is not supported on this platform. - - - The current thread attempted to reacquire a mutex that has reached its maximum acquire count. - - - Insufficient state to return the real object. - - - Cannot get the member '{0}'. - - - The method signature cannot be null. - - - Unknown member type. - - - Non existent ParameterInfo. Position bigger than member's parameters length. - - - Serialized member does not have a ParameterInfo. - - - Assembly cannot be null. - - - The NeutralResourcesLanguageAttribute on the assembly "{0}" specifies an invalid culture name: "{1}". - - - The NeutralResourcesLanguageAttribute specifies an invalid or unrecognized ultimate resource fallback location: "{0}". - - - Satellite contract version attribute on the assembly '{0}' specifies an invalid version: {1}. - - - Type parameter must refer to a subclass of ResourceSet. - - - Corrupt .resources file. A resource name extends past the end of the stream. - - - Corrupt .resources file. Resource name extends past the end of the file. - - - '{0}': ResourceSet derived classes must provide a constructor that takes a String file name and a constructor that takes a Stream. - - - Resource '{0}' was not a Stream - call GetObject instead. - - - A case-insensitive lookup for resource file "{0}" in assembly "{1}" found multiple entries. Remove the duplicates or specify the exact case. - - - Could not find the resource "{0}" among the resources {2} embedded in the assembly "{1}", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name. - - - Could not find any resources appropriate for the specified culture (or the neutral culture) on disk. - - - Unable to open Package Resource Index. - - - Unable to load resources for resource file "{0}" in package "{1}". - - - The satellite assembly named "{1}" for fallback culture "{0}" either could not be found or could not be loaded. This is generally a setup problem. Please consider reinstalling or repairing the application. - - - Resource lookup fell back to the ultimate fallback resources in a satellite assembly, but that satellite either was not found or could not be loaded. Please consider reinstalling or repairing the application. - - - Delegates that are not of type MulticastDelegate may not be combined. - - - Found an obsolete .resources file in assembly '{0}'. Rebuild that .resources file then rebuild that assembly. - - - Cannot read resources that depend on serialization. - - - Cannot access a closed resource set. - - - The specified resource name "{0}" does not exist in the resource file. - - - Corrupt .resources file. The specified data length '{0}' is not a valid position in the stream. - - - Corrupt .resources file. String for name index '{0}' extends past the end of the file. - - - Resource '{0}' was not a String - call GetObject instead. - - - Resource was of type '{0}' instead of String - call GetObject instead. - - - This .resources file should not be read with this reader. The resource reader type is "{0}". - - - Type must derive from Delegate. - - - Serialization of global methods (including implicit serialization via the use of asynchronous delegates) is not supported. - - - This operation is invalid on overlapping buffers. - - - DelegateSerializationHolder objects are designed to represent a delegate during serialization and are not serializable themselves. - - - The delegate cannot be serialized properly due to missing metadata for the target method. - - - Uninitialized Strings cannot be created. - - - totalSize is too large. For more information about setting the maximum size, see \"Latency Modes\" in http://go.microsoft.com/fwlink/?LinkId=522706. - - - The NoGCRegion mode was already in progress. - - - Allocated memory exceeds specified memory for NoGCRegion mode. - - - Garbage collection was induced in NoGCRegion mode. - - - NoGCRegion mode must be set. - - - The NoGCRegion mode is in progress. End it and then set a different mode. - - - This API is not available when the concurrent GC is enabled. - - - Thread is running or terminated; it cannot restart. - - - Thread is dead; priority cannot be accessed. - - - Thread is dead; state cannot be accessed. - - - Thread has not been started. - - - Unable to set thread priority. - - - Object fields may not be properly initialized. - - - OnDeserialization method was called while the object was not being deserialized. - - - Cannot create an abstract class. - - - Cannot create a type for which Type.ContainsGenericParameters is true. - - - Value was invalid. - - - Cannot create uninitialized instances of types requiring managed activation. - - - ResourceManager method '{0}' is not supported when reading from .resw resource files. - - - ResourceManager property '{0}' is not supported when reading from .resw resource files. - - - Object cannot be cast to DBNull. - - - This feature is not currently implemented. - - - The corresponding delegate has been garbage collected. Please make sure the delegate is still referenced by managed code when you are using the marshalled native function pointer. - - - Ambiguous match found. - - - ChangeType operation is not supported. - - - Array may not be empty. - - - Member not found. - - - Field not found. - - - Object cannot be cast from DBNull to other types. - - - Only one DBNull instance may exist, and calls to DBNull deserialization methods are not allowed. - - - The invoked member is not supported in a dynamic assembly. - - - The serialized Capacity property of StringBuilder must be positive, less than or equal to MaxCapacity and greater than or equal to the String length. - - - The serialized MaxCapacity property of StringBuilder must be positive and greater than or equal to the String length. - - - Remoting is not supported on this platform. - - - Strong-name signing is not supported on this platform. - - - Invalid serialized DateTime data. Unable to find 'ticks' or 'dateData'. - - - The values for this dictionary are missing. - - - Invalid serialized DateTime data. Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. - - - The ANSI string passed in could not be converted from the default ANSI code page to Unicode. - - - The string must be null-terminated. - - - ArgIterator is not supported on this platform. - - - Type had been unloaded. - - - Value was either too large or too small for a Currency. - - - Secure binary serialization is not supported on this platform. - - - An IntPtr or UIntPtr with an eight byte value cannot be deserialized on a machine with a four byte word size. - - - The keys and values arrays have different sizes. - - - Abstract event source must not declare event methods ({0} with ID {1}). - - - Abstract event source must not declare {0} nested type. - - - Getting out of bounds during scalar addition. - - - Bad Hexidecimal digit "{0}". - - - Channel {0} does not match event channel value {1}. - - - Data descriptors are out of range. - - - Multiple definitions for string "{0}". - - - The type of {0} is not expected in {1}. - - - Must have an even number of Hexidecimal digits. - - - Channel {0} has a value of {1} which is outside the legal range (16-254). - - - Event {0} has ID {1} which is already in use. - - - Event {0} (with ID {1}) has a non-default opcode but not a task. - - - Event method {0} (with ID {1}) is an explicit interface method implementation. Re-write method as implicit implementation. - - - Event {0} (with ID {1}) has a name that is not the concatenation of its task name and opcode. - - - Event name {0} used more than once. If you wish to overload a method, the overloaded method should have a NonEvent attribute. - - - Event {0} was called with {1} argument(s), but it is defined with {2} parameter(s). - - - An instance of EventSource with Guid {0} already exists. - - - The payload for a single event is too large. - - - Event {0} specifies an Admin channel {1}. It must specify a Message property. - - - Keyword {0} has a value of {1} which is outside the legal range (0-0x0000080000000000). - - - Opcode {0} has a value of {1} which is outside the legal range (11-238). - - - Task {0} has a value of {1} which is outside the legal range (1-65535). - - - Illegal value "{0}" (prefix strings with @ to indicate a literal string). - - - Incorrectly-authored TypeInfo - a type should be serialized as one field or as one group - - - Invalid command value. - - - Can't specify both etw event format flags. - - - Keywords {0} and {1} are defined with the same value ({2}). - - - Value {0} for keyword {1} needs to be a power of 2. - - - Creating an EventListener inside a EventListener callback. - - - Listener not found. - - - An error occurred when writing to a listener. - - - Attempt to define more than the maximum limit of 8 channels for a provider. - - - Event {0} was assigned event ID {1} but {2} was passed to WriteEvent. - - - The Guid of an EventSource must be non zero. - - - The name of an EventSource must not be null. - - - Event IDs must be positive integers. - - - No Free Buffers available from the operating system (e.g. event rate too fast). - - - The API supports only anonymous types or types decorated with the EventDataAttribute. Non-compliant type: {0} dataType. - - - EventSource expects the first parameter of the Event method to be of type Guid and to be named "relatedActivityId" when calling WriteEventWithRelatedActivityId. - - - Arrays of Binary are not supported. - - - Arrays of Nil are not supported. - - - Arrays of null-terminated string are not supported. - - - Enumerables of custom-serialized data are not supported - - - Nested arrays/enumerables are not supported. - - - Null passed as a event argument. - - - Opcodes {0} and {1} are defined with the same value ({2}). - - - Pins are out of range. - - - Recursive type definition is not supported. - - - Bit position in AllKeywords ({0}) must equal the command argument named "EtwSessionKeyword" ({1}). - - - An event with stop suffix must follow a corresponding event with a start suffix. - - - Tasks {0} and {1} are defined with the same value ({2}). - - - Event {0} (with ID {1}) has the same task/opcode pair as event {2} (with ID {3}). - - - Too many arguments. - - - Too many fields in structure. - - - EventSource({0}, {1}) - - - There must be an even number of trait strings (they are key-value pairs). - - - Event source types must be sealed or abstract. - - - Event source types must derive from EventSource. - - - Use of undefined channel value {0} for event {1}. - - - Use of undefined keyword value {0} for event {1}. - - - Use of undefined opcode value {0} for event {1}. - - - Unknown ETW trait "{0}". - - - Unsupported type {0} in event source. - - - Event {0} specifies an illegal or unsupported formatting message ("{1}"). - - - The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly. - - - Stream was not writable. - - - Unicode surrogate characters must be written out as pairs together in the same call, not individually. Consider passing in a character array instead. - - - '{0}' field specified was not found. - - - '{0}' property specified was not found. - - - Equals() on Span and ReadOnlySpan is not supported. Use operator== instead. - - - GetHashCode() on Span and ReadOnlySpan is not supported. - - - Destination is too short. - - - Cannot use type '{0}'. Only value types without pointers or references are supported. - - - Overlapping spans have mismatching alignment. - - - Array.ConstrainedCopy will only work on array types that are provably compatible, without any form of boxing, unboxing, widening, or casting of each array element. Change the array types (i.e., copy a Derived[] to a Base[]), or use a mitigation strategy in the CER for Array.Copy's less powerful reliability contract, such as cloning the array or throwing away the potentially corrupt destination array. - - - Dll was not found. - - - Unable to load DLL '{0}': The specified module could not be found. - - - Attempted to access a drive that is not available. - - - Type could not be marshaled because the length of an embedded array instance does not match the declared length in the layout. - - - Cannot marshal: Encountered unmappable character. - - - Marshaling directives are invalid. - - - No value exists with that name. - - - Registry value names should not be greater than 16,383 characters. - - - Serializing delegates is not supported on this platform. - - - Cannot create an instance of {0} as it is an open type. - - - AssemblyName.GetAssemblyName() is not supported on this platform. - - - Cannot create arrays of open type. - - - Cannot create arrays of ByRef-like values. - - - at - - - --- End of stack trace from previous location where exception was thrown --- - - - The given assembly name or codebase was invalid - - - Must be an array type. - - - Left to right characters may not be mixed with right to left characters in IDN labels. - - - IDN labels must be between 1 and 63 characters long. - - - IDN names must be between 1 and {0} characters long. - - - Invalid IDN encoded string. - - - Label contains character '{0}' not allowed with UseStd3AsciiRules - - - Decoded string is not a valid IDN name. - - - This operation is only valid on generic types. - - - This method is not supported on signature types. - - - Memory<T> has been disposed. - - - Release all references before disposing this instance. - - - HashCode is a mutable struct and should not be compared with other HashCodes. Use ToHashCode to retrieve the computed hash code. - - - HashCode is a mutable struct and should not be compared with other HashCodes. - - - Cannot write to a closed TextWriter. - - - Cannot read from a closed TextReader. - - - The read operation returned an invalid length. - - - Basepath argument is not fully qualified. - - - Number of elements in source vector is greater than the destination array - - - Specified type is not supported - - - The method was called with a null array argument. - - - At least {0} element(s) are expected in the parameter "{1}". - - - The target method returned a null reference. - - - Computer name could not be obtained. - - - Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. - - - Failed to set the specified COM apartment state. - - - Use CompressedStack.(Capture/Run) instead. - - - This operation must be performed on the same thread as that represented by the Thread instance. - - - The SyncRoot property may not be used for the synchronization of concurrent collections. - - - IAsyncResult object did not come from the corresponding async method on this type. - - - EndRead can only be called once for each asynchronous operation. - - - EndWrite can only be called once for each asynchronous operation. - - - Either the IAsyncResult object did not come from the corresponding async method on this type, or EndRead was called multiple times with the same IAsyncResult. - - - Either the IAsyncResult object did not come from the corresponding async method on this type, or EndWrite was called multiple times with the same IAsyncResult. - - - The week parameter must be in the range 1 through 53. - - - The type serialized in the .resources file was not the same type that the .resources file said it contained. Expected '{0}' but read '{1}'. - - - Cannot extract a Unicode scalar value from the specified index in the input. - - - Characters following the format symbol must be a number of {0} or less. - - - The 'G' format combined with a precision is not supported. - - - Precision cannot be larger than {0}. - - - Cannot load hostpolicy library. AssemblyDependencyResolver is currently only supported if the runtime is hosted through hostpolicy library. - - - Dependency resolution failed for component {0} with error code {1}. Detailed error: {2} - - - An action was attempted during deserialization that could lead to a security vulnerability. The action has been aborted. - - - An action was attempted during deserialization that could lead to a security vulnerability. The action has been aborted. To allow the action, set the '{0}' AppContext switch to true. - - - Assembly.LoadFrom with hashValue is not supported. - - - Bad IL format. - - - Length of items must be same as length of keys. - - - Cannot write to a BufferedStream while the read buffer is not empty if the underlying stream is not seekable. Ensure that the stream underlying this BufferedStream can seek or avoid interleaving read and write operations on this BufferedStream. - - - Found invalid data while decoding. - - - Resource type in the ResourceScope enum is going from a more restrictive resource type to a more general one. From: "{0}" To: "{1}" - - - The type parameter cannot be null when scoping the resource's visibility to Private or Assembly. - - - Unknown value for the ResourceScope: {0} Too many resource type bits may be set. - - - Unknown value for the ResourceScope: {0} Too many resource visibility bits may be set. - - - The parameter '{0}' cannot be an empty string. - - - ApplicationId cannot have an empty string for the name. - - - FrameworkName is invalid. - - - FrameworkName version component is invalid. - - - FrameworkName version component is missing. - - - FrameworkName cannot have less than two components or more than three components. - - - Non-exhaustive switch expression failed to match its input. - - - Attempted to marshal an object across a context boundary. - - - Attempted to access an unloaded AppDomain. - - - Unmatched value was {0}. - - - Support for UTF-7 is disabled. See {0} for more information. - - - Type '{0}' returned by IDynamicInterfaceCastable does not implement the requested interface '{1}'. - - - Type '{0}' returned by IDynamicInterfaceCastable does not have the attribute '{1}'. - - - Type '{0}' returned by IDynamicInterfaceCastable is not an interface. - - - The body of this method was removed by the AOT compiler because it's not callable. - - - The feature associated with this method was removed. - - - The body of this instance method was removed by the AOT compiler. This can happen if the owning type was not seen as allocated by the AOT compiler. - - - Object must be of type Half. - - - Object must be of type Rune. - - - BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information. - - - The argv[0] argument cannot include a double quote. - - - Attempt to update previously set global instance. - - - Use of ResourceManager for custom types is disabled. Set the MSBuild Property CustomResourceTypesSupport to true in order to enable it. - - - COM Interop requires ComWrapper instance registered for marshalling. - - - Queue empty. - - - The target file '{0}' is a directory, not a file. - - - Invalid File or Directory attributes value. - - - Second path fragment must not be a drive or UNC name. - - - Path must not be a drive. - - - The stream's length cannot be changed. - - - The directory specified, '{0}', is not a subdirectory of '{1}'. - - - The specified directory '{0}' cannot be created. - - - The source '{0}' and destination '{1}' are the same file. - - - The specified path '{0}' is not a file. - - - Source and destination path must be different. - - - Source and destination path must have identical roots. Move will not work across volumes. - - - Synchronous operations should not be performed on the UI thread. Consider wrapping this method in Task.Run. - - - Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader. - - - File encryption is not supported on this platform. - - - A MemberInfo that matches '{0}' could not be found. - - - Bad magic in '{0}': Header starts with '{1}' instead of 'tzdata' - - - Unable to fully read from file '{0}' at offset {1} length {2}; read {3} bytes expected {4}. - - - Length in index file less than AndroidTzDataHeader - - - Unable to properly load any time zone data files. - - - NullabilityInfoContext is not supported in the current application because 'System.Reflection.NullabilityInfoContext.IsSupported' is set to false. Set the MSBuild Property 'NullabilityInfoContextSupport' to true in order to enable it. - - diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index 98bc1de6522ca..cf0cab0700eba 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -10,6 +10,14 @@ + + + + true + System.SR + + + SYSTEM_PRIVATE_CORELIB;FEATURE_MANAGED_ETW_CHANNELS;FEATURE_MANAGED_ETW;$(DefineConstants) true diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreRT.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreRT.cs index 2e746cd92b7ac..a5fc83731d7a9 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreRT.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreRT.cs @@ -129,12 +129,14 @@ internal void AppendToStackTrace(StringBuilder builder) // Passing a default string for "at" in case SR.UsingResourceKeys() is true // as this is a special case and we don't want to have "Word_At" on stack traces. string word_At = SR.GetResourceString(nameof(SR.Word_At), defaultString: "at"); - builder.AppendFormat(" {0} ", word_At); + builder.Append(" ").Append(word_At).Append(' '); builder.AppendLine(DeveloperExperience.Default.CreateStackTraceString(_ipAddress, _needFileInfo)); } if (_isLastFrameFromForeignExceptionStackTrace) { - builder.AppendLine(SR.StackTrace_EndStackTraceFromPreviousThrow); + // Passing default for Exception_EndStackTraceFromPreviousThrow in case SR.UsingResourceKeys is set. + builder.AppendLine(SR.GetResourceString(nameof(SR.Exception_EndStackTraceFromPreviousThrow), + defaultString: "--- End of stack trace from previous location ---")); } } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/InvokeUtils.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/InvokeUtils.cs index 98ae0f132d979..6fa54fdf3b208 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/InvokeUtils.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/InvokeUtils.cs @@ -320,13 +320,13 @@ private static object GetDefaultValue(object targetMethodOrDelegate, RuntimeType { if (targetMethodOrDelegate == null) { - throw new ArgumentException(SR.Arg_DefaultValueMissingException); + throw new ArgumentException(SR.Arg_VarMissNull); } bool hasDefaultValue = RuntimeAugments.Callbacks.TryGetDefaultParameterValue(targetMethodOrDelegate, thType, argIndex, out object defaultValue); if (!hasDefaultValue) { - throw new ArgumentException(SR.Arg_DefaultValueMissingException, "parameters"); + throw new ArgumentException(SR.Arg_VarMissNull, "parameters"); } // Note that we might return null even for value types which cannot have null value here. diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreRT.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreRT.cs index 0ce4004357365..bc3ef37804315 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreRT.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreRT.cs @@ -28,7 +28,7 @@ private byte[] ComputePublicKeyToken() private static AssemblyName GetFileInformationCore(string assemblyFile) { - throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported_AssemblyName_GetAssemblyName); + throw new PlatformNotSupportedException(SR.PlatformNotSupported_AssemblyName_GetAssemblyName); } } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Windows.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Windows.cs index a829d4d16e478..458914cfc577a 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Windows.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Windows.cs @@ -64,7 +64,7 @@ public static unsafe int ConvertWideCharToMultiByte(char* wideCharStr, ); if (defaultCharUsed != 0) { - throw new ArgumentException(SR.Arg_InteropMarshalUnmappableChar); + throw new ArgumentException(SR.Interop_Marshal_Unmappable_Char); } return ret; diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.PlatformNotSupported.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.PlatformNotSupported.cs index d84ac07463d53..781f1a94b2dad 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.PlatformNotSupported.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.PlatformNotSupported.cs @@ -22,7 +22,7 @@ private PreAllocatedOverlapped(IOCompletionCallback callback, object? state, obj if (callback == null) throw new ArgumentNullException(nameof(callback)); - throw new PlatformNotSupportedException(SR.NotSupported_Overlapped); + throw new PlatformNotSupportedException(SR.PlatformNotSupported_OverlappedIO); } public void Dispose() diff --git a/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs b/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs index ab093a379d20d..d5824a3d2a58f 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs @@ -30,7 +30,6 @@ public enum ExceptionStringID InvalidProgramSpecific, InvalidProgramVararg, InvalidProgramCallVirtFinalize, - InvalidProgramUnmanagedCallersOnly, InvalidProgramCallAbstractMethod, InvalidProgramCallVirtStatic, InvalidProgramNonStaticMethod, diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs index e868b3e1f418c..f662d76c3e41f 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs @@ -418,11 +418,6 @@ private void ImportCall(ILOpcode opcode, int token) TypeDesc exactType = method.OwningType; - if (method.IsUnmanagedCallersOnly && (opcode != ILOpcode.ldftn && opcode != ILOpcode.ldvirtftn)) - { - ThrowHelper.ThrowInvalidProgramException(ExceptionStringID.InvalidProgramUnmanagedCallersOnly, method); - } - bool resolvedConstraint = false; bool forceUseRuntimeLookup = false; diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs index 885873032fd72..5966efead0066 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs @@ -1105,14 +1105,6 @@ private void getCallInfo(ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_RESO throw new BadImageFormatException(); } - // This block enforces the rule that methods with [UnmanagedCallersOnly] attribute - // can only be called from unmanaged code. The call from managed code is replaced - // with a stub that throws an InvalidProgramException - if (method.IsUnmanagedCallersOnly && (flags & CORINFO_CALLINFO_FLAGS.CORINFO_CALLINFO_LDFTN) == 0) - { - ThrowHelper.ThrowInvalidProgramException(ExceptionStringID.InvalidProgramUnmanagedCallersOnly, method); - } - TypeDesc exactType = HandleToObject(pResolvedToken.hClass); TypeDesc constrainedType = null; diff --git a/src/coreclr/vm/comsynchronizable.cpp b/src/coreclr/vm/comsynchronizable.cpp index 027627d4851d7..76b511a0e2c68 100644 --- a/src/coreclr/vm/comsynchronizable.cpp +++ b/src/coreclr/vm/comsynchronizable.cpp @@ -257,7 +257,7 @@ void ThreadNative::Start(Thread* pNewThread, int threadStackSize, int priority, // Is the thread already started? You can't restart a thread. if (!ThreadNotStarted(pNewThread)) { - COMPlusThrow(kThreadStateException, IDS_EE_THREADSTART_STATE); + COMPlusThrow(kThreadStateException, W("ThreadState_AlreadyStarted")); } #ifdef FEATURE_COMINTEROP_APARTMENT_SUPPORT @@ -338,7 +338,7 @@ FCIMPL1(INT32, ThreadNative::GetPriority, ThreadBaseObject* pThisUNSAFE) // validate the handle if (ThreadIsDead(pThisUNSAFE->GetInternal())) - FCThrowEx(kThreadStateException, IDS_EE_THREAD_DEAD_PRIORITY, NULL, NULL, NULL); + FCThrowRes(kThreadStateException, W("ThreadState_Dead_Priority")); return pThisUNSAFE->m_Priority; } @@ -367,7 +367,7 @@ FCIMPL2(void, ThreadNative::SetPriority, ThreadBaseObject* pThisUNSAFE, INT32 iP if (ThreadIsDead(thread)) { - COMPlusThrow(kThreadStateException, IDS_EE_THREAD_DEAD_PRIORITY, NULL, NULL, NULL); + COMPlusThrow(kThreadStateException, W("ThreadState_Dead_Priority")); } INT32 oldPriority = pThis->m_Priority; @@ -379,7 +379,7 @@ FCIMPL2(void, ThreadNative::SetPriority, ThreadBaseObject* pThisUNSAFE, INT32 iP if (!thread->SetThreadPriority(priority)) { pThis->m_Priority = oldPriority; - COMPlusThrow(kThreadStateException, IDS_EE_THREAD_PRIORITY_FAIL, NULL, NULL, NULL); + COMPlusThrow(kThreadStateException, W("ThreadState_SetPriorityFailed")); } HELPER_METHOD_FRAME_END(); @@ -595,7 +595,7 @@ FCIMPL2(void, ThreadNative::SetBackground, ThreadBaseObject* pThisUNSAFE, CLR_BO Thread *thread = pThisUNSAFE->GetInternal(); if (ThreadIsDead(thread)) - FCThrowExVoid(kThreadStateException, IDS_EE_THREAD_DEAD_STATE, NULL, NULL, NULL); + FCThrowResVoid(kThreadStateException, W("ThreadState_Dead_State")); HELPER_METHOD_FRAME_BEGIN_0(); @@ -617,7 +617,7 @@ FCIMPL1(FC_BOOL_RET, ThreadNative::IsBackground, ThreadBaseObject* pThisUNSAFE) Thread *thread = pThisUNSAFE->GetInternal(); if (ThreadIsDead(thread)) - FCThrowEx(kThreadStateException, IDS_EE_THREAD_DEAD_STATE, NULL, NULL, NULL); + FCThrowRes(kThreadStateException, W("ThreadState_Dead_State")); FC_RETURN_BOOL(thread->IsBackground()); } @@ -780,7 +780,7 @@ FCIMPL1(INT32, ThreadNative::GetApartmentState, ThreadBaseObject* pThisUNSAFE) if (ThreadIsDead(thread)) { - COMPlusThrow(kThreadStateException, IDS_EE_THREAD_DEAD_STATE); + COMPlusThrow(kThreadStateException, W("ThreadState_Dead_State")); } Thread::ApartmentState state = thread->GetApartment(); @@ -854,7 +854,7 @@ BOOL ThreadNative::DoJoin(THREADBASEREF DyingThread, INT32 timeout) if (DyingInternal == 0 || !(DyingInternal->m_State & Thread::TS_LegalToJoin)) { - COMPlusThrow(kThreadStateException, IDS_EE_THREAD_NOTSTARTED); + COMPlusThrow(kThreadStateException, W("ThreadState_NotStarted")); } // Don't grab the handle until we know it has started, to eliminate the race @@ -1070,7 +1070,7 @@ FCIMPL1(FC_BOOL_RET, ThreadNative::IsThreadpoolThread, ThreadBaseObject* thread) Thread *pThread = thread->GetInternal(); if (pThread == NULL) - FCThrowEx(kThreadStateException, IDS_EE_THREAD_DEAD_STATE, NULL, NULL, NULL); + FCThrowRes(kThreadStateException, W("ThreadState_Dead_State")); BOOL ret = pThread->IsThreadPoolThread(); @@ -1090,7 +1090,7 @@ FCIMPL1(void, ThreadNative::SetIsThreadpoolThread, ThreadBaseObject* thread) Thread *pThread = thread->GetInternal(); if (pThread == NULL) - FCThrowExVoid(kThreadStateException, IDS_EE_THREAD_DEAD_STATE, NULL, NULL, NULL); + FCThrowResVoid(kThreadStateException, W("ThreadState_Dead_State")); pThread->SetIsThreadPoolThread(); } diff --git a/src/coreclr/vm/reflectioninvocation.cpp b/src/coreclr/vm/reflectioninvocation.cpp index 8b61726f44726..495e10e4f4a36 100644 --- a/src/coreclr/vm/reflectioninvocation.cpp +++ b/src/coreclr/vm/reflectioninvocation.cpp @@ -1100,7 +1100,7 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod, LPVOID pReturnedReference = *(LPVOID*)&callDescrData.returnValue; if (pReturnedReference == NULL) { - COMPlusThrow(kNullReferenceException, IDS_INVOKE_NULLREF_RETURNED); + COMPlusThrow(kNullReferenceException, W("NullReference_InvokeNullRefReturned")); } CopyValueClass(gc.retVal->GetData(), pReturnedReference, gc.retVal->GetMethodTable()); } @@ -1123,7 +1123,7 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod, LPVOID pReturnedReference = *(LPVOID*)&callDescrData.returnValue; if (pReturnedReference == NULL) { - COMPlusThrow(kNullReferenceException, IDS_INVOKE_NULLREF_RETURNED); + COMPlusThrow(kNullReferenceException, W("NullReference_InvokeNullRefReturned")); } gc.retVal = InvokeUtil::CreateObjectAfterInvoke(refReturnTargetTH, pReturnedReference); diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index 6db3b715805a1..8e4ff90383181 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -2644,6 +2644,9 @@ Could not load the specified file. + + Could not load the file '{0}'. + File name: '{0}' @@ -3163,9 +3166,6 @@ Multiple custom attributes of the same type found. - - Ambiguous match found. - An Int32 must be provided for the filter criteria. @@ -3820,4 +3820,121 @@ NullabilityInfoContext is not supported in the current application because 'System.Reflection.NullabilityInfoContext.IsSupported' is set to false. Set the MSBuild Property 'NullabilityInfoContextSupport' to true in order to enable it. + + Thread is running or terminated; it cannot restart. + + + Thread has not been started. + + + Thread is dead; priority cannot be accessed. + + + Thread is dead; state cannot be accessed. + + + Unable to set thread priority. + + + The target method returned a null reference. + + + Cannot create an instance of {0} as it is an open type. + + + lohSize can't be greater than totalSize + + + totalSize is too large. For more information about setting the maximum size, see "Latency Modes" in http://go.microsoft.com/fwlink/?LinkId=522706. + + + The NoGCRegion mode was already in progress. + + + Allocated memory exceeds specified memory for NoGCRegion mode. + + + Garbage collection was induced in NoGCRegion mode. + + + NoGCRegion mode must be set. + + + Dynamic code generation is not supported on this platform. + + + AssemblyName.GetAssemblyName() is not supported on this platform. + + + Arrays with non-zero lower bounds are not supported. + + + The body of this method was removed by the AOT compiler because it's not callable. + + + The feature associated with this method was removed. + + + The body of this instance method was removed by the AOT compiler. This can happen if the owning type was not seen as allocated by the AOT compiler. + + + Attempted to load a type that was not created during ahead of time compilation. + + + A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property. + + + The given assembly name or codebase was invalid + + + Invalid assembly public key. + + + Could not load type '{0}' from assembly '{1}'. + + + '{0}' from assembly '{1}' has too many dimensions. + + + Could not load type '{0}' from assembly '{1}' because generic types cannot have explicit layout. + + + Could not load type '{0}' from assembly '{1}' because the format is invalid. + + + Array of type '{0}' from assembly '{1}' cannot be created because base value type is too large. + + + Could not load type '{0}' from assembly '{1}' because it contains an object field at offset '{2}' that is incorrectly aligned or overlapped by a non-object field. + + + Method not found: '{0}'. + + + Field not found: '{0}'. + + + Common Language Runtime detected an invalid program. The body of method '{0}' is invalid. + + + Method '{0}' has a variable argument list. Variable argument lists are not supported in .NET Core. + + + Object.Finalize() can not be called directly. It is only callable by the runtime. + + + The corresponding delegate has been garbage collected. Please make sure the delegate is still referenced by managed code when you are using the marshalled native function pointer. + + + Unable to find an entry point named '{0}' in native library '{1}'. + + + Unable to find an entry point named '{0}' in native library. + + + Unable to native library '{0}' or one of its dependencies. + + + COM Interop requires ComWrapper instance registered for marshalling. + diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/AmbiguousMatchException.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/AmbiguousMatchException.cs index 53b7e08c820cc..024ba7ac99fed 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/AmbiguousMatchException.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/AmbiguousMatchException.cs @@ -10,7 +10,7 @@ namespace System.Reflection public sealed class AmbiguousMatchException : SystemException { public AmbiguousMatchException() - : base(SR.RFLCT_Ambiguous) + : base(SR.Arg_AmbiguousMatchException) { HResult = HResults.COR_E_AMBIGUOUSMATCH; } diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs index c9cd0ed68eb17..70fe2ac4566b5 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs @@ -279,7 +279,7 @@ private ThreadState ValidateThreadState() { ThreadState state = GetState(this); if ((state & ThreadState.Stopped) != 0) - throw new ThreadStateException("Thread is dead; state can not be accessed."); + throw new ThreadStateException(SR.ThreadState_Dead_State); return state; } From 61250b4a35a2662dbadbc0906003c5e434c697dc Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 24 Dec 2021 16:57:28 -0800 Subject: [PATCH 2/3] Use default AmbiguousMatchException message where possible --- .../src/System/RuntimeType.CoreCLR.cs | 14 +++++++------- .../src/Resources/Strings.resx | 3 --- .../Reflection/Runtime/General/ThunkedApis.cs | 2 +- .../TypeInfos/RuntimeTypeInfo.BindingFlags.cs | 2 +- .../src/Resources/Strings.resx | 5 +---- .../src/System/DefaultBinder.cs | 12 ++++++------ .../src/Resources/Strings.resx | 5 +---- .../src/System/Reflection/DefaultBinder.cs | 8 ++++---- .../TypeLoading/RuntimeTypeInfo.BindingFlags.cs | 2 +- .../TypeLoading/Types/RoType.GetInterface.cs | 2 +- .../src/System/RuntimeType.Mono.cs | 14 +++++++------- 11 files changed, 30 insertions(+), 39 deletions(-) diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs index 3752e61158624..2c7bb900641aa 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs @@ -2769,7 +2769,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn MethodInfo methodInfo = candidates[j]; if (!System.DefaultBinder.CompareMethodSig(methodInfo, firstCandidate)) { - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } @@ -2837,7 +2837,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn { if (returnType is null) // if we are here we have no args or property type to select over and we have more than one property with that name - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } @@ -2866,7 +2866,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn if ((bindingAttr & eventInfo.BindingFlags) == eventInfo.BindingFlags) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = eventInfo; } @@ -2896,7 +2896,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn if (match != null) { if (ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType)) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); if ((match.DeclaringType!.IsInterface) && (fieldInfo.DeclaringType!.IsInterface)) multipleStaticFieldMatches = true; @@ -2908,7 +2908,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn } if (multipleStaticFieldMatches && match!.DeclaringType!.IsInterface) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return match; } @@ -2940,7 +2940,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn if (FilterApplyType(iface, bindingAttr, name, false, ns)) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = iface; } @@ -2969,7 +2969,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn if (FilterApplyType(nestedType, bindingAttr, name, false, ns)) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = nestedType; } diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Resources/Strings.resx b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Resources/Strings.resx index 84cbca76e08bb..a19d41e9c09d8 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Resources/Strings.resx +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Resources/Strings.resx @@ -231,9 +231,6 @@ Member not found. - - Ambiguous match found. - There is no metadata token available for the given member. diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ThunkedApis.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ThunkedApis.cs index 7a50b6f3b19ae..5e78685061b9c 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ThunkedApis.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ThunkedApis.cs @@ -201,7 +201,7 @@ public sealed override Type GetInterface(string name, bool ignoreCase) if (ns != null && !ns.Equals(ifc.Namespace)) continue; if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = ifc; } return match; diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs index 45c95cfecb5c7..7193fd2cff885 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs @@ -168,7 +168,7 @@ protected sealed override PropertyInfo GetPropertyImpl(string name, BindingFlags { if (returnType is null) // if we are here we have no args or property type to select over and we have more than one property with that name - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Resources/Strings.resx b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Resources/Strings.resx index 25fa97370a3f5..dfb2f92a4b27a 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Resources/Strings.resx +++ b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Resources/Strings.resx @@ -132,9 +132,6 @@ Member not found. - - Ambiguous match found. - Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table. @@ -225,4 +222,4 @@ Cannot set initonly static field after its owning type is initialized. - \ No newline at end of file + diff --git a/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs b/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs index 9cd5f01a951e3..1290a00f59c51 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs @@ -369,7 +369,7 @@ public sealed override MethodBase BindToMethod( } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); // Reorder (if needed) if (names != null) @@ -515,7 +515,7 @@ public sealed override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo } } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -609,7 +609,7 @@ public sealed override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo } } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -725,7 +725,7 @@ public sealed override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -841,7 +841,7 @@ public sealed override void ReorderArgumentArray(ref object?[] args, object stat continue; if (bestMatch != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); bestMatch = match[i]; } @@ -1128,7 +1128,7 @@ private static int GetHierarchyDepth(Type t) // This can only happen if at least one is vararg or generic. if (currentHierarchyDepth == deepestHierarchy) { - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } // Check to see if this method is on the most derived class. diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/Resources/Strings.resx b/src/libraries/System.Reflection.MetadataLoadContext/src/Resources/Strings.resx index 6e447252b303c..d5a40f23b3169 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/src/Resources/Strings.resx +++ b/src/libraries/System.Reflection.MetadataLoadContext/src/Resources/Strings.resx @@ -125,9 +125,6 @@ The enum type should contain one and only one instance field. - - Ambiguous match found. - Array may not be empty. @@ -269,4 +266,4 @@ The path '{0}' is not valid. - \ No newline at end of file + diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/DefaultBinder.cs b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/DefaultBinder.cs index 2160fb5151293..4c0ec188cbfe0 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/DefaultBinder.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/DefaultBinder.cs @@ -138,7 +138,7 @@ public sealed override MethodBase BindToMethod( } } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -257,7 +257,7 @@ public sealed override MethodBase BindToMethod( } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -337,7 +337,7 @@ public sealed override MethodBase BindToMethod( continue; if (bestMatch != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); bestMatch = match[i]; } @@ -602,7 +602,7 @@ private static int GetHierarchyDepth(Type t) // This can only happen if at least one is vararg or generic. if (currentHierarchyDepth == deepestHierarchy) { - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } // Check to see if this method is on the most derived class. diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/RuntimeTypeInfo.BindingFlags.cs b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/RuntimeTypeInfo.BindingFlags.cs index d2fa6dcbc80e6..8d1be59255ed7 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/RuntimeTypeInfo.BindingFlags.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/RuntimeTypeInfo.BindingFlags.cs @@ -150,7 +150,7 @@ internal abstract partial class RoType { if (returnType is null) // if we are here we have no args or property type to select over and we have more than one property with that name - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Types/RoType.GetInterface.cs b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Types/RoType.GetInterface.cs index 7c2d8d662aa99..d7d3d8474d1da 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Types/RoType.GetInterface.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Types/RoType.GetInterface.cs @@ -31,7 +31,7 @@ internal abstract partial class RoType if (ns.Length != 0 && !ns.Equals(ifc.Namespace)) continue; if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = ifc; } return match; diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs index 95e19d9fb365b..21267d651bc11 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs @@ -797,7 +797,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { MethodInfo methodInfo = candidates[j]; if (!System.DefaultBinder.CompareMethodSig(methodInfo, firstCandidate)) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } // All the methods have the exact same name and sig so return the most derived one. @@ -868,7 +868,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { if (returnType is null) // if we are here we have no args or property type to select over and we have more than one property with that name - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } @@ -900,7 +900,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) if ((bindingAttr & eventInfo.BindingFlags) == eventInfo.BindingFlags) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = eventInfo; } @@ -929,7 +929,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) if (match != null) { if (ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType)) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); if ((match.DeclaringType!.IsInterface == true) && (fieldInfo.DeclaringType!.IsInterface == true)) multipleStaticFieldMatches = true; @@ -941,7 +941,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) } if (multipleStaticFieldMatches && match!.DeclaringType!.IsInterface) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return match; } @@ -991,7 +991,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) if (FilterApplyType(iface, bindingAttr, name, false, ns)) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = iface; } @@ -1019,7 +1019,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) if (FilterApplyType(nestedType, bindingAttr, name, false, ns)) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = nestedType; } From 690f27527de7c3c310b2dbd2fdf46ae50ae014c9 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sat, 25 Dec 2021 11:01:17 -0800 Subject: [PATCH 3/3] Print error message for calling UnmanagedCallersOnly method from managed code. --- .../src/System/Runtime/ExceptionHandling.cs | 5 ++--- .../src/System/Runtime/RuntimeExports.cs | 9 --------- src/coreclr/nativeaot/Runtime/amd64/PInvoke.asm | 2 -- src/coreclr/nativeaot/Runtime/arm/PInvoke.asm | 2 -- src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm | 2 -- src/coreclr/nativeaot/Runtime/i386/PInvoke.asm | 2 -- src/coreclr/nativeaot/Runtime/thread.cpp | 5 +---- .../nativeaot/Runtime/unix/PalRedhawkUnix.cpp | 13 +------------ .../src/System/RuntimeExceptionHelpers.cs | 7 ++----- .../src/System/RuntimeExceptionHelpers.cs | 5 ++--- 10 files changed, 8 insertions(+), 44 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs index a0c392325267f..8027dee124fbe 100644 --- a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs +++ b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs @@ -20,10 +20,9 @@ public enum RhFailFastReason UnhandledException_ExceptionDispatchNotAllowed = 2, // "Unhandled exception: no handler found before escaping a finally clause or other fail-fast scope." UnhandledException_CallerDidNotHandle = 3, // "Unhandled exception: no handler found in calling method." ClassLibDidNotTranslateExceptionID = 4, // "Unable to translate failure into a classlib-specific exception object." - IllegalUnmanagedCallersOnlyEntry = 5, // "Invalid Program: attempted to call a UnmanagedCallersOnly method from runtime-typesafe code." - PN_UnhandledException = 6, // ProjectN: "unhandled exception" - PN_UnhandledExceptionFromPInvoke = 7, // ProjectN: "Unhandled exception: an unmanaged exception was thrown out of a managed-to-native transition." + PN_UnhandledException = 5, // ProjectN: "unhandled exception" + PN_UnhandledExceptionFromPInvoke = 6, // ProjectN: "Unhandled exception: an unmanaged exception was thrown out of a managed-to-native transition." Max } diff --git a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs index 91acbb4edbd37..53860b7cdaba0 100644 --- a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs +++ b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs @@ -293,15 +293,6 @@ public static unsafe object RhMemberwiseClone(object src) return objClone; } - [RuntimeExport("RhpReversePInvokeBadTransition")] - public static void RhpReversePInvokeBadTransition(IntPtr returnAddress) - { - EH.FailFastViaClasslib( - RhFailFastReason.IllegalUnmanagedCallersOnlyEntry, - null, - returnAddress); - } - [RuntimeExport("RhGetCurrentThreadStackTrace")] [MethodImpl(MethodImplOptions.NoInlining)] // Ensures that the RhGetCurrentThreadStackTrace frame is always present public static unsafe int RhGetCurrentThreadStackTrace(IntPtr[] outputBuffer) diff --git a/src/coreclr/nativeaot/Runtime/amd64/PInvoke.asm b/src/coreclr/nativeaot/Runtime/amd64/PInvoke.asm index 973dc8da2f06c..c692f4537d328 100644 --- a/src/coreclr/nativeaot/Runtime/amd64/PInvoke.asm +++ b/src/coreclr/nativeaot/Runtime/amd64/PInvoke.asm @@ -3,8 +3,6 @@ include asmmacros.inc -extern RhpReversePInvokeBadTransition : proc - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; diff --git a/src/coreclr/nativeaot/Runtime/arm/PInvoke.asm b/src/coreclr/nativeaot/Runtime/arm/PInvoke.asm index 95c116b0a5132..fd1f4d0e358a5 100644 --- a/src/coreclr/nativeaot/Runtime/arm/PInvoke.asm +++ b/src/coreclr/nativeaot/Runtime/arm/PInvoke.asm @@ -5,8 +5,6 @@ TEXTAREA - IMPORT RhpReversePInvokeBadTransition - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; RhpWaitForSuspend -- rare path for RhpPInvoke and RhpReversePInvokeReturn diff --git a/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm b/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm index d8ee2bb056d87..7692bfa8341be 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm +++ b/src/coreclr/nativeaot/Runtime/arm64/PInvoke.asm @@ -5,8 +5,6 @@ TEXTAREA - IMPORT RhpReversePInvokeBadTransition - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; RhpWaitForSuspend -- rare path for RhpPInvoke and RhpReversePInvokeReturn diff --git a/src/coreclr/nativeaot/Runtime/i386/PInvoke.asm b/src/coreclr/nativeaot/Runtime/i386/PInvoke.asm index 526a04ba40a00..85d550d1be4ca 100644 --- a/src/coreclr/nativeaot/Runtime/i386/PInvoke.asm +++ b/src/coreclr/nativeaot/Runtime/i386/PInvoke.asm @@ -9,8 +9,6 @@ include AsmMacros.inc -extern RhpReversePInvokeBadTransition : proc - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; RhpWaitForSuspend -- rare path for RhpPInvoke and RhpReversePInvokeReturn diff --git a/src/coreclr/nativeaot/Runtime/thread.cpp b/src/coreclr/nativeaot/Runtime/thread.cpp index 5a76666c11faa..2b4a6ccb83a9c 100644 --- a/src/coreclr/nativeaot/Runtime/thread.cpp +++ b/src/coreclr/nativeaot/Runtime/thread.cpp @@ -1202,10 +1202,7 @@ void Thread::ReversePInvokeAttachOrTrapThread(ReversePInvokeFrame * pFrame) // The TSF_DoNotTriggerGc mode is handled by the fast path (InlineTryFastReversePInvoke or equivalent assembly code) ASSERT(!IsDoNotTriggerGcSet()); - // The platform specific assembly PInvoke helpers will route this fault to the class library inferred from the return - // address for nicer error reporting. For configurations without assembly helpers, we are going to fail fast without - // going through the class library here. - // RhpReversePInvokeBadTransition(return address); + PalPrintFatalError("\nFatal error. Invalid Program: attempted to call a UnmanagedCallersOnly method from managed code.\n"); RhFailFast(); } diff --git a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp index 73ef7612cf519..f7b876a672145 100644 --- a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp +++ b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp @@ -71,17 +71,6 @@ using std::nullptr_t; #define PalRaiseFailFastException RaiseFailFastException -#define FATAL_ASSERT(e, msg) \ - do \ - { \ - if (!(e)) \ - { \ - fprintf(stderr, "FATAL ERROR: " msg); \ - RhFailFast(); \ - } \ - } \ - while(0) - #define INVALID_HANDLE_VALUE ((HANDLE)(intptr_t)-1) #define PAGE_NOACCESS 0x01 @@ -724,7 +713,7 @@ REDHAWK_PALEXPORT void PalPrintFatalError(const char* message) { // Write the message using lowest-level OS API available. This is used to print the stack overflow // message, so there is not much that can be done here. - write(STDERR_FILENO, message, sizeof(message)); + write(STDERR_FILENO, message, strlen(message)); } static int W32toUnixAccessControl(uint32_t flProtect) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeExceptionHelpers.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeExceptionHelpers.cs index c46c692567011..ec4d5ae61011e 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeExceptionHelpers.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeExceptionHelpers.cs @@ -125,9 +125,8 @@ public enum RhFailFastReason UnhandledException_ExceptionDispatchNotAllowed = 2, // "Unhandled exception: no handler found before escaping a finally clause or other fail-fast scope." UnhandledException_CallerDidNotHandle = 3, // "Unhandled exception: no handler found in calling method." ClassLibDidNotTranslateExceptionID = 4, // "Unable to translate failure into a classlib-specific exception object." - IllegalUnmanagedCallersOnlyEntry = 5, // "Invalid Program: attempted to call a UnmanagedCallersOnly method from runtime-typesafe code." - PN_UnhandledException = 6, // ProjectN: "Unhandled exception: a managed exception was not handled before reaching unmanaged code" - PN_UnhandledExceptionFromPInvoke = 7, // ProjectN: "Unhandled exception: an unmanaged exception was thrown out of a managed-to-native transition." + PN_UnhandledException = 5, // ProjectN: "Unhandled exception: a managed exception was not handled before reaching unmanaged code" + PN_UnhandledExceptionFromPInvoke = 6, // ProjectN: "Unhandled exception: an unmanaged exception was thrown out of a managed-to-native transition." Max } @@ -143,8 +142,6 @@ private static string GetStringForFailFastReason(RhFailFastReason reason) return "Unhandled exception: no handler found in calling method."; case RhFailFastReason.ClassLibDidNotTranslateExceptionID: return "Unable to translate failure into a classlib-specific exception object."; - case RhFailFastReason.IllegalUnmanagedCallersOnlyEntry: - return "Invalid Program: attempted to call a UnmanagedCallersOnly method from runtime-typesafe code."; case RhFailFastReason.PN_UnhandledException: return "Unhandled exception: a managed exception was not handled before reaching unmanaged code."; case RhFailFastReason.PN_UnhandledExceptionFromPInvoke: diff --git a/src/coreclr/nativeaot/Test.CoreLib/src/System/RuntimeExceptionHelpers.cs b/src/coreclr/nativeaot/Test.CoreLib/src/System/RuntimeExceptionHelpers.cs index 777b5790d145b..9eeacfecfeaaa 100644 --- a/src/coreclr/nativeaot/Test.CoreLib/src/System/RuntimeExceptionHelpers.cs +++ b/src/coreclr/nativeaot/Test.CoreLib/src/System/RuntimeExceptionHelpers.cs @@ -87,9 +87,8 @@ public enum RhFailFastReason UnhandledException_ExceptionDispatchNotAllowed = 2, // "Unhandled exception: no handler found before escaping a finally clause or other fail-fast scope." UnhandledException_CallerDidNotHandle = 3, // "Unhandled exception: no handler found in calling method." ClassLibDidNotTranslateExceptionID = 4, // "Unable to translate failure into a classlib-specific exception object." - IllegalUnmanagedCallersOnlyEntry = 5, // "Invalid Program: attempted to call a UnmanagedCallersOnly method from runtime-typesafe code." - PN_UnhandledException = 6, // ProjectN: "Unhandled exception: a managed exception was not handled before reaching unmanaged code" - PN_UnhandledExceptionFromPInvoke = 7, // ProjectN: "Unhandled exception: an unmanaged exception was thrown out of a managed-to-native transition." + PN_UnhandledException = 5, // ProjectN: "Unhandled exception: a managed exception was not handled before reaching unmanaged code" + PN_UnhandledExceptionFromPInvoke = 6, // ProjectN: "Unhandled exception: an unmanaged exception was thrown out of a managed-to-native transition." Max }