You've already forked linux-packaging-mono
Imported Upstream version 6.0.0.172
Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
parent
8016999e4d
commit
64ac736ec5
@ -15,6 +15,9 @@ namespace System
|
||||
public static readonly bool ThrowExceptionIfDisposedCancellationTokenSource = false;
|
||||
public static readonly bool SetActorAsReferenceWhenCopyingClaimsIdentity = false;
|
||||
public static readonly bool NoAsyncCurrentCulture = false;
|
||||
public static readonly bool EnforceJapaneseEraYearRanges = false;
|
||||
public static readonly bool FormatJapaneseFirstYearAsANumber = false;
|
||||
public static readonly bool EnforceLegacyJapaneseDateParsing = false;
|
||||
#else
|
||||
private static int _noAsyncCurrentCulture;
|
||||
public static bool NoAsyncCurrentCulture
|
||||
@ -26,6 +29,36 @@ namespace System
|
||||
}
|
||||
}
|
||||
|
||||
// from https://github.com/dotnet/coreclr/pull/18209
|
||||
private static int _enforceJapaneseEraYearRanges;
|
||||
public static bool EnforceJapaneseEraYearRanges
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
return GetCachedSwitchValue(AppContextDefaultValues.SwitchEnforceJapaneseEraYearRanges, ref _enforceJapaneseEraYearRanges);
|
||||
}
|
||||
}
|
||||
|
||||
private static int _formatJapaneseFirstYearAsANumber;
|
||||
public static bool FormatJapaneseFirstYearAsANumber
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
return GetCachedSwitchValue(AppContextDefaultValues.SwitchFormatJapaneseFirstYearAsANumber, ref _formatJapaneseFirstYearAsANumber);
|
||||
}
|
||||
}
|
||||
private static int _enforceLegacyJapaneseDateParsing;
|
||||
public static bool EnforceLegacyJapaneseDateParsing
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
return GetCachedSwitchValue(AppContextDefaultValues.SwitchEnforceLegacyJapaneseDateParsing, ref _enforceLegacyJapaneseDateParsing);
|
||||
}
|
||||
}
|
||||
|
||||
private static int _throwExceptionIfDisposedCancellationTokenSource;
|
||||
public static bool ThrowExceptionIfDisposedCancellationTokenSource
|
||||
{
|
||||
|
@ -13,17 +13,19 @@ namespace System {
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Security;
|
||||
#if !MONO
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
|
||||
[Serializable]
|
||||
[AttributeUsageAttribute(AttributeTargets.All, Inherited = true, AllowMultiple=false)]
|
||||
#if !MOBILE
|
||||
#if !MOBILE && !NETCORE
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ComDefaultInterface(typeof(_Attribute))]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
#endif
|
||||
public abstract partial class Attribute
|
||||
#if !MOBILE
|
||||
#if !MOBILE && !NETCORE
|
||||
: _Attribute
|
||||
#endif
|
||||
{
|
||||
@ -68,7 +70,7 @@ namespace System {
|
||||
custom_attributes.Add (param_attribute);
|
||||
}
|
||||
|
||||
var base_method = method.GetBaseMethod ();
|
||||
var base_method = ((RuntimeMethodInfo)method).GetBaseMethod ();
|
||||
if (base_method == method)
|
||||
break;
|
||||
|
||||
@ -103,7 +105,7 @@ namespace System {
|
||||
if (member.MemberType != MemberTypes.Method)
|
||||
return false;
|
||||
|
||||
var method = ((MethodInfo) member).GetBaseMethod ();
|
||||
var method = ((RuntimeMethodInfo)(MethodInfo) member).GetBaseMethod ();
|
||||
|
||||
while (true) {
|
||||
var parameters = method.GetParametersInternal ();
|
||||
@ -113,7 +115,7 @@ namespace System {
|
||||
if (param.IsDefined (attributeType, false))
|
||||
return true;
|
||||
|
||||
var base_method = method.GetBaseMethod ();
|
||||
var base_method = ((RuntimeMethodInfo)method).GetBaseMethod ();
|
||||
if (base_method == method)
|
||||
break;
|
||||
|
||||
@ -1048,7 +1050,7 @@ namespace System {
|
||||
public virtual bool IsDefaultAttribute() { return false; }
|
||||
#endregion
|
||||
|
||||
#if !FEATURE_CORECLR && !MOBILE
|
||||
#if !FEATURE_CORECLR && !MOBILE && !NETCORE
|
||||
void _Attribute.GetTypeInfoCount(out uint pcTInfo)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -34,8 +34,10 @@ namespace System {
|
||||
// parameter validation has already been done. The count and offset
|
||||
// parameters here are in bytes. If you want to use traditional
|
||||
// array element indices and counts, use Array.Copy.
|
||||
#if !MONO
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal static extern bool InternalBlockCopy(Array src, int srcOffsetBytes,
|
||||
Array dst, int dstOffsetBytes, int byteCount);
|
||||
@ -131,8 +133,10 @@ namespace System {
|
||||
// This essentially does the following:
|
||||
// return ((byte*)array) + index.
|
||||
//
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern byte _GetByte(Array array, int index);
|
||||
#if !MONO
|
||||
@ -160,8 +164,10 @@ namespace System {
|
||||
// This essentially does the following:
|
||||
// *(((byte*)array) + index) = value.
|
||||
//
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern void _SetByte(Array array, int index, byte value);
|
||||
#if !MONO
|
||||
@ -191,8 +197,10 @@ namespace System {
|
||||
// This essentially does the following:
|
||||
// return array.length * sizeof(array.UnderlyingElementType).
|
||||
//
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern int _ByteLength(Array array);
|
||||
#if !MONO
|
||||
|
@ -511,7 +511,8 @@ namespace System {
|
||||
throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
|
||||
return candidates[currentMin];
|
||||
}
|
||||
|
||||
|
||||
#if !MONO
|
||||
// Given a set of methods that match the base criteria, select a method based
|
||||
// upon an array of types. This method should return null if no method matchs
|
||||
// the criteria.
|
||||
@ -588,6 +589,7 @@ namespace System {
|
||||
throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
|
||||
return candidates[currentMin];
|
||||
}
|
||||
#endif
|
||||
|
||||
// Given a set of properties that match the base criteria, select one.
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
|
@ -28,7 +28,9 @@
|
||||
#elif BARTOK_RUNTIME
|
||||
|
||||
#else // CLR
|
||||
#if !MONO
|
||||
#define FEATURE_UNTRUSTED_CALLERS
|
||||
#endif
|
||||
#define FEATURE_RELIABILITY_CONTRACTS
|
||||
#define FEATURE_SERIALIZATION
|
||||
#endif
|
||||
|
@ -38,8 +38,10 @@ using System.Runtime.ConstrainedExecution;
|
||||
#endif
|
||||
#if FEATURE_UNTRUSTED_CALLERS
|
||||
using System.Security;
|
||||
#if !MONO
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace System.Diagnostics.Contracts {
|
||||
|
||||
@ -57,8 +59,10 @@ namespace System.Diagnostics.Contracts {
|
||||
[SecuritySafeCritical]
|
||||
static partial void AssertMustUseRewriter(ContractFailureKind kind, String contractKind)
|
||||
{
|
||||
#if !NETCORE
|
||||
if (_assertingMustUseRewriter)
|
||||
System.Diagnostics.Assert.Fail("Asserting that we must use the rewriter went reentrant.", "Didn't rewrite this mscorlib?");
|
||||
#endif
|
||||
_assertingMustUseRewriter = true;
|
||||
|
||||
// For better diagnostics, report which assembly is at fault. Walk up stack and
|
||||
|
@ -243,13 +243,17 @@ namespace System
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern int InternalCompareTo(Object o1, Object o2);
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecuritySafeCritical]
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal static extern RuntimeType InternalGetUnderlyingType(RuntimeType enumType);
|
||||
|
||||
@ -264,8 +268,10 @@ namespace System
|
||||
private static extern void GetEnumValuesAndNames(RuntimeTypeHandle enumType, ObjectHandleOnStack values, ObjectHandleOnStack names, bool getNames);
|
||||
#endif
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern Object InternalBoxEnum(RuntimeType enumType, long value);
|
||||
#endregion
|
||||
@ -554,13 +560,14 @@ namespace System
|
||||
// Delegate rest of error checking to the other functions
|
||||
TypeCode typeCode = Convert.GetTypeCode(value);
|
||||
|
||||
#if !MONO
|
||||
// NetCF doesn't support char and boolean conversion
|
||||
if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 &&
|
||||
((typeCode == TypeCode.Boolean) || (typeCode == TypeCode.Char)))
|
||||
{
|
||||
throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnumBaseTypeOrEnum"), "value");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
switch (typeCode)
|
||||
{
|
||||
@ -747,17 +754,19 @@ namespace System
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private extern bool InternalHasFlag(Enum flags);
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
#if MONO
|
||||
private extern int get_hashcode ();
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
private extern CorElementType InternalGetCorElementType();
|
||||
#endif
|
||||
#endregion
|
||||
@ -1223,5 +1232,37 @@ namespace System
|
||||
return InternalBoxEnum(rtType, value ? 1 : 0);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#if MONO
|
||||
public static TEnum Parse<TEnum>(string value) where TEnum : struct
|
||||
{
|
||||
return Parse<TEnum>(value, false);
|
||||
}
|
||||
|
||||
public static TEnum Parse<TEnum>(string value, bool ignoreCase) where TEnum : struct
|
||||
{
|
||||
EnumResult parseResult = new EnumResult() { canThrow = true };
|
||||
if (TryParseEnum(typeof(TEnum), value, ignoreCase, ref parseResult))
|
||||
return (TEnum)parseResult.parsedEnum;
|
||||
else
|
||||
throw parseResult.GetEnumParseException();
|
||||
}
|
||||
|
||||
public static bool TryParse(Type enumType, String value, bool ignoreCase, out object result)
|
||||
{
|
||||
result = null;
|
||||
EnumResult parseResult = new EnumResult();
|
||||
bool retValue;
|
||||
|
||||
if (retValue = TryParseEnum(enumType, value, ignoreCase, ref parseResult))
|
||||
result = parseResult.parsedEnum;
|
||||
return retValue;
|
||||
}
|
||||
|
||||
public static bool TryParse(Type enumType, String value, out object result)
|
||||
{
|
||||
return TryParse(enumType, value, false, out result);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,9 @@ namespace System {
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Diagnostics;
|
||||
#if !MONO
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
using System.Security;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@ -31,16 +33,21 @@ namespace System {
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics.Contracts;
|
||||
#if NETCORE
|
||||
using __HResults = System.HResults;
|
||||
#endif
|
||||
|
||||
#if !MONO
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ComDefaultInterface(typeof(_Exception))]
|
||||
#endif
|
||||
[Serializable]
|
||||
[ComVisible(true)]
|
||||
#if MONO
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
#endif
|
||||
public class Exception : ISerializable
|
||||
#if !(MONO && MOBILE)
|
||||
public partial class Exception : ISerializable
|
||||
#if !MOBILE && !NETCORE
|
||||
, _Exception
|
||||
#endif
|
||||
{
|
||||
@ -162,12 +169,15 @@ namespace System {
|
||||
public virtual IDictionary Data {
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
get {
|
||||
if (_data == null)
|
||||
if (_data == null) {
|
||||
#if !MONO
|
||||
if (IsImmutableAgileException(this))
|
||||
_data = new EmptyReadOnlyDictionaryInternal();
|
||||
else
|
||||
#endif
|
||||
_data = new ListDictionaryInternal();
|
||||
|
||||
}
|
||||
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
@ -210,7 +220,9 @@ namespace System {
|
||||
}
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
[FriendAccessAllowed]
|
||||
#endif
|
||||
internal void AddExceptionDataForRestrictedErrorInfo(
|
||||
string restrictedError,
|
||||
string restrictedErrorReference,
|
||||
@ -390,8 +402,10 @@ namespace System {
|
||||
String tempStackTraceString = Environment.GetStackTrace(this, needFileInfo);
|
||||
return remoteStackTraceString + tempStackTraceString;
|
||||
}
|
||||
|
||||
|
||||
#if !MONO
|
||||
[FriendAccessAllowed]
|
||||
#endif
|
||||
internal void SetErrorCode(int hr)
|
||||
{
|
||||
HResult = hr;
|
||||
@ -643,7 +657,7 @@ namespace System {
|
||||
// this assert to ensure that it fails when that exception's _safeSerializationManager is NULL
|
||||
Contract.Assert(((_safeSerializationManager != null) || (this.GetType().Assembly == typeof(object).Assembly)),
|
||||
"User defined exceptions must have a valid _safeSerializationManager");
|
||||
|
||||
|
||||
// Handle serializing any transparent or partial trust subclass data
|
||||
_safeSerializationManager.CompleteSerialization(this, info, context);
|
||||
}
|
||||
@ -748,7 +762,14 @@ namespace System {
|
||||
_stackTrace = null;
|
||||
_stackTraceString = null;
|
||||
}
|
||||
|
||||
|
||||
#if MONO
|
||||
// This is only needed for Watson support
|
||||
private string StripFileInfo(string stackTrace, bool isRemoteStackTrace) {
|
||||
return stackTrace;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FEATURE_EXCEPTIONDISPATCHINFO
|
||||
|
||||
// This is the object against which a lock will be taken
|
||||
@ -785,12 +806,7 @@ namespace System {
|
||||
}
|
||||
}
|
||||
|
||||
#if MONO
|
||||
// This is only needed for Watson support
|
||||
private string StripFileInfo(string stackTrace, bool isRemoteStackTrace) {
|
||||
return stackTrace;
|
||||
}
|
||||
#else
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
@ -949,7 +965,10 @@ namespace System {
|
||||
{
|
||||
return _HResult;
|
||||
}
|
||||
protected set
|
||||
#if !NETCORE
|
||||
protected
|
||||
#endif
|
||||
set
|
||||
{
|
||||
_HResult = value;
|
||||
}
|
||||
@ -978,6 +997,8 @@ namespace System {
|
||||
|
||||
// Mono addition: Used on iPhone
|
||||
IntPtr[] native_trace_ips;
|
||||
|
||||
int caught_in_unmanaged;
|
||||
#endif
|
||||
|
||||
// See clr\src\vm\excep.h's EXCEPTION_COMPLUS definition:
|
||||
@ -1107,8 +1128,8 @@ namespace System {
|
||||
internal Exception FixRemotingException ()
|
||||
{
|
||||
string message = (0 == _remoteStackIndex) ?
|
||||
Locale.GetText ("{0}{0}Server stack trace: {0}{1}{0}{0}Exception rethrown at [{2}]: {0}") :
|
||||
Locale.GetText ("{1}{0}{0}Exception rethrown at [{2}]: {0}");
|
||||
"{0}{0}Server stack trace: {0}{1}{0}{0}Exception rethrown at [{2}]: {0}" :
|
||||
"{1}{0}{0}Exception rethrown at [{2}]: {0}";
|
||||
string tmp = String.Format (message, Environment.NewLine, StackTrace, _remoteStackIndex);
|
||||
|
||||
_remoteStackTraceString = tmp;
|
||||
|
@ -18,7 +18,9 @@ namespace System {
|
||||
//This class only static members and doesn't require the serializable keyword.
|
||||
|
||||
using System;
|
||||
#if !MONO
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
@ -63,7 +65,7 @@ namespace System {
|
||||
NotApplicable = 4
|
||||
}
|
||||
|
||||
public static class GC
|
||||
public static partial class GC
|
||||
{
|
||||
#if MONO
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
@ -101,6 +103,9 @@ namespace System {
|
||||
lastRecordedHeapSize = UIntPtr.Zero;
|
||||
lastRecordedFragmentation = UIntPtr.Zero;
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
public static extern long GetAllocatedBytesForCurrentThread ();
|
||||
#else
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
@ -226,7 +231,9 @@ namespace System {
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
#endif
|
||||
#if !MONO
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
public static extern int GetGeneration(Object obj);
|
||||
|
||||
@ -418,8 +425,10 @@ namespace System {
|
||||
|
||||
// Indicates that the system should not call the Finalize() method on
|
||||
// an object that would normally require this call.
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
private static extern void _SuppressFinalize(Object o);
|
||||
@ -437,8 +446,10 @@ namespace System {
|
||||
// for which SuppressFinalize has already been called. The other situation
|
||||
// where calling ReRegisterForFinalize is useful is inside a finalizer that
|
||||
// needs to resurrect itself or an object that it references.
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern void _ReRegisterForFinalize(Object o);
|
||||
|
||||
|
@ -44,6 +44,9 @@ namespace System.Globalization {
|
||||
// is derived from DateTime class.
|
||||
//
|
||||
internal const int MaxYear = 9999;
|
||||
#if MONO
|
||||
internal const int MinYear = 1; // needed for ISOWeek
|
||||
#endif
|
||||
|
||||
internal GregorianCalendarTypes m_type;
|
||||
|
||||
|
@ -141,7 +141,86 @@ namespace System.Globalization {
|
||||
m_maxYear = m_EraInfo[0].maxEraYear;
|
||||
m_minYear = m_EraInfo[0].minEraYear;;
|
||||
}
|
||||
|
||||
|
||||
#if MONO // see https://github.com/dotnet/coreclr/pull/18209
|
||||
// EraInfo.yearOffset: The offset to Gregorian year when the era starts. Gregorian Year = Era Year + yearOffset
|
||||
// Era Year = Gregorian Year - yearOffset
|
||||
// EraInfo.minEraYear: Min year value in this era. Generally, this value is 1, but this may be affected by the DateTime.MinValue;
|
||||
// EraInfo.maxEraYear: Max year value in this era. (== the year length of the era + 1)
|
||||
private int GetYearOffset(int year, int era, bool throwOnError)
|
||||
{
|
||||
if (year < 0)
|
||||
{
|
||||
if (throwOnError)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(year), SR.ArgumentOutOfRange_NeedNonNegNum);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (era == Calendar.CurrentEra)
|
||||
{
|
||||
era = m_Cal.CurrentEraValue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_EraInfo.Length; i++)
|
||||
{
|
||||
if (era == m_EraInfo[i].era)
|
||||
{
|
||||
if (year >= m_EraInfo[i].minEraYear)
|
||||
{
|
||||
if (year <= m_EraInfo[i].maxEraYear)
|
||||
{
|
||||
return m_EraInfo[i].yearOffset;
|
||||
}
|
||||
else if (!AppContextSwitches.EnforceJapaneseEraYearRanges)
|
||||
{
|
||||
// If we got the year number exceeding the era max year number, this still possible be valid as the date can be created before
|
||||
// introducing new eras after the era we are checking. we'll loop on the eras after the era we have and ensure the year
|
||||
// can exist in one of these eras. otherwise, we'll throw.
|
||||
// Note, we always return the offset associated with the requested era.
|
||||
//
|
||||
// Here is some example:
|
||||
// if we are getting the era number 4 (Heisei) and getting the year number 32. if the era 4 has year range from 1 to 31
|
||||
// then year 32 exceeded the range of era 4 and we'll try to find out if the years difference (32 - 31 = 1) would lay in
|
||||
// the subsequent eras (e.g era 5 and up)
|
||||
|
||||
int remainingYears = year - m_EraInfo[i].maxEraYear;
|
||||
|
||||
for (int j = i - 1; j >= 0; j--)
|
||||
{
|
||||
if (remainingYears <= m_EraInfo[j].maxEraYear)
|
||||
{
|
||||
return m_EraInfo[i].yearOffset;
|
||||
}
|
||||
remainingYears -= m_EraInfo[j].maxEraYear;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (throwOnError)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
nameof(year),
|
||||
string.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
SR.ArgumentOutOfRange_Range,
|
||||
m_EraInfo[i].minEraYear,
|
||||
m_EraInfo[i].maxEraYear));
|
||||
}
|
||||
|
||||
break; // no need to iterate more on eras.
|
||||
}
|
||||
}
|
||||
|
||||
if (throwOnError)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*=================================GetGregorianYear==========================
|
||||
**Action: Get the Gregorian year value for the specified year in an era.
|
||||
**Returns: The Gregorian year value.
|
||||
@ -153,6 +232,9 @@ namespace System.Globalization {
|
||||
============================================================================*/
|
||||
|
||||
internal int GetGregorianYear(int year, int era) {
|
||||
#if MONO
|
||||
return GetYearOffset(year, era, throwOnError: true) + year;
|
||||
#else
|
||||
if (year < 0) {
|
||||
throw new ArgumentOutOfRangeException("year",
|
||||
Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
|
||||
@ -178,9 +260,13 @@ namespace System.Globalization {
|
||||
}
|
||||
}
|
||||
throw new ArgumentOutOfRangeException("era", Environment.GetResourceString("ArgumentOutOfRange_InvalidEraValue"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
internal bool IsValidYear(int year, int era) {
|
||||
#if MONO
|
||||
return GetYearOffset(year, era, throwOnError: false) >= 0;
|
||||
#else
|
||||
if (year < 0) {
|
||||
return false;
|
||||
}
|
||||
@ -198,8 +284,8 @@ namespace System.Globalization {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns a given date part of this DateTime. This method is used
|
||||
// to compute the year, day-of-year, month, or day part.
|
||||
|
@ -159,7 +159,7 @@ namespace System.IO {
|
||||
case Win32Native.ERROR_ALREADY_EXISTS:
|
||||
if (str.Length == 0)
|
||||
goto default;
|
||||
throw new IOException(Environment.GetResourceString("IO.IO_AlreadyExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
|
||||
throw new IOException(Environment.GetResourceString("IO.IO_AlreadyExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode));
|
||||
|
||||
case Win32Native.ERROR_FILENAME_EXCED_RANGE:
|
||||
throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
|
||||
@ -168,24 +168,24 @@ namespace System.IO {
|
||||
throw new DriveNotFoundException(Environment.GetResourceString("IO.DriveNotFound_Drive", str));
|
||||
|
||||
case Win32Native.ERROR_INVALID_PARAMETER:
|
||||
throw new IOException(Win32Native.GetMessage(errorCode), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
|
||||
throw new IOException(Win32Native.GetMessage(errorCode), Win32Native.MakeHRFromErrorCode(errorCode));
|
||||
|
||||
case Win32Native.ERROR_SHARING_VIOLATION:
|
||||
if (str.Length == 0)
|
||||
throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_NoFileName"), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
|
||||
throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_NoFileName"), Win32Native.MakeHRFromErrorCode(errorCode));
|
||||
else
|
||||
throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_File", str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
|
||||
throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_File", str), Win32Native.MakeHRFromErrorCode(errorCode));
|
||||
|
||||
case Win32Native.ERROR_FILE_EXISTS:
|
||||
if (str.Length == 0)
|
||||
goto default;
|
||||
throw new IOException(Environment.GetResourceString("IO.IO_FileExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
|
||||
throw new IOException(Environment.GetResourceString("IO.IO_FileExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode));
|
||||
|
||||
case Win32Native.ERROR_OPERATION_ABORTED:
|
||||
throw new OperationCanceledException();
|
||||
|
||||
default:
|
||||
throw new IOException(Win32Native.GetMessage(errorCode), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
|
||||
throw new IOException(Win32Native.GetMessage(errorCode), Win32Native.MakeHRFromErrorCode(errorCode));
|
||||
}
|
||||
}
|
||||
#if !MONO
|
||||
|
@ -254,7 +254,7 @@ namespace System.IO {
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public StreamReader OpenText()
|
||||
{
|
||||
return new StreamReader(FullPath, Encoding.UTF8, true, StreamReader.DefaultBufferSize, false);
|
||||
return new StreamReader(FullPath, Encoding.UTF8, detectEncodingFromByteOrderMarks: true);
|
||||
}
|
||||
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
|
@ -794,7 +794,7 @@ namespace System.IO
|
||||
FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, permissionName, false, false);
|
||||
#endif
|
||||
#endif
|
||||
DirectoryInfo di = new DirectoryInfo(name, false);
|
||||
DirectoryInfo di = new DirectoryInfo(Path.GetFileName(name), fullPath: name, isNormalized: true);
|
||||
di.InitializeFrom(result.FindData);
|
||||
return di;
|
||||
}
|
||||
@ -833,7 +833,7 @@ namespace System.IO
|
||||
FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, permissionName, false, false);
|
||||
#endif
|
||||
#endif
|
||||
DirectoryInfo di = new DirectoryInfo(name, false);
|
||||
DirectoryInfo di = new DirectoryInfo(Path.GetFileName(name), fullPath: name, isNormalized: true);
|
||||
di.InitializeFrom(result.FindData);
|
||||
return di;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
// ==--==
|
||||
// <OWNER>Microsoft</OWNER>
|
||||
//
|
||||
#if !FULL_AOT_RUNTIME
|
||||
#if MONO_FEATURE_SRE
|
||||
namespace System.Reflection.Emit
|
||||
{
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -791,7 +791,7 @@ namespace System.Resources {
|
||||
// For the case that we've memory mapped in the .resources
|
||||
// file, just return a Stream pointing to that block of memory.
|
||||
unsafe {
|
||||
return new UnmanagedMemoryStream(_ums.PositionPointer, len, len, FileAccess.Read, true);
|
||||
return new UnmanagedMemoryStream(_ums.PositionPointer, len, len, FileAccess.Read);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
131a11060435d35ce6b010151023448480ab65f9
|
||||
14e9c98271b7092feb7ff984bdddbdc5a9f1acdd
|
@ -408,7 +408,7 @@ namespace System.Runtime.CompilerServices
|
||||
/// It must only be used by the debugger and tracing pruposes, and only in a single-threaded manner
|
||||
/// when no other threads are in the middle of accessing this property or this.Task.
|
||||
/// </remarks>
|
||||
private object ObjectIdForDebugger { get { return this.Task; } }
|
||||
internal object ObjectIdForDebugger { get { return this.Task; } }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -850,7 +850,6 @@ namespace System.Runtime.CompilerServices
|
||||
|
||||
// This method is copy&pasted into the public Start methods to avoid size overhead of valuetype generic instantiations.
|
||||
// Ideally, we would build intrinsics to get the raw ref address and raw code address of MoveNext, and just use the shared implementation.
|
||||
#if false
|
||||
/// <summary>Initiates the builder's execution with the associated state machine.</summary>
|
||||
/// <typeparam name="TStateMachine">Specifies the type of the state machine.</typeparam>
|
||||
/// <param name="stateMachine">The state machine instance, passed by reference.</param>
|
||||
@ -880,7 +879,6 @@ namespace System.Runtime.CompilerServices
|
||||
ecs.Undo();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>Associates the builder with the state machine it represents.</summary>
|
||||
/// <param name="stateMachine">The heap-allocated state machine object.</param>
|
||||
|
@ -17,7 +17,7 @@
|
||||
**
|
||||
=============================================================================*/
|
||||
|
||||
#if FEATURE_EXCEPTIONDISPATCHINFO
|
||||
#if FEATURE_EXCEPTIONDISPATCHINFO || MONO
|
||||
namespace System.Runtime.ExceptionServices {
|
||||
using System;
|
||||
|
||||
@ -150,8 +150,10 @@ namespace System.Runtime.ExceptionServices {
|
||||
#endif
|
||||
public void Throw()
|
||||
{
|
||||
#if FEATURE_EXCEPTIONDISPATCHINFO
|
||||
// Restore the exception dispatch details before throwing the exception.
|
||||
m_Exception.RestoreExceptionDispatchInfo(this);
|
||||
#endif
|
||||
throw m_Exception;
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,8 @@ namespace System.Runtime.InteropServices{
|
||||
}
|
||||
public TypeLibVarFlags Value { get {return _val;} }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
[Serializable]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public enum VarEnum
|
||||
@ -799,7 +800,7 @@ namespace System.Runtime.InteropServices{
|
||||
PInvokeAttributes flags = 0;
|
||||
|
||||
#if MONO
|
||||
((MonoMethod)method).GetPInvoke(out flags, out entryPoint, out dllName);
|
||||
((RuntimeMethodInfo)method).GetPInvoke(out flags, out entryPoint, out dllName);
|
||||
#else
|
||||
scope.GetPInvokeMap(token, out flags, out entryPoint, out dllName);
|
||||
#endif
|
||||
@ -882,6 +883,7 @@ namespace System.Runtime.InteropServices{
|
||||
|
||||
}
|
||||
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public unsafe sealed class StructLayoutAttribute : Attribute
|
||||
@ -1066,8 +1068,7 @@ namespace System.Runtime.InteropServices{
|
||||
public Type SourceInterface { get {return _SourceInterface;} }
|
||||
public Type EventProvider { get {return _EventProvider;} }
|
||||
}
|
||||
#endif
|
||||
#if FEATURE_COMINTEROP || MOBILE_LEGACY
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public sealed class TypeLibVersionAttribute : Attribute
|
||||
@ -1164,5 +1165,4 @@ namespace System.Runtime.InteropServices{
|
||||
public String MethodName { get { return _methodName; } }
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user