Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete NativeAOT-specific CoreLib string resources #63129

Merged
merged 3 commits into from
Dec 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/coreclr/System.Private.CoreLib/src/System/GC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 0 additions & 7 deletions src/coreclr/dlls/mscorrc/mscorrc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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

Expand Down
9 changes: 0 additions & 9 deletions src/coreclr/dlls/mscorrc/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,14 @@
#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
#define IDS_EE_VARARG_NOT_SUPPORTED 0x1a0f

#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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;
}
}

Expand All @@ -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;
}
}

Expand All @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading