Imported Upstream version 6.0.0.172

Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-04-12 14:10:50 +00:00
parent 8016999e4d
commit 64ac736ec5
32155 changed files with 3981439 additions and 75368 deletions

View File

@@ -5,6 +5,9 @@ namespace System
internal static class AppContextDefaultValues
{
internal const string SwitchNoAsyncCurrentCulture = "Switch.System.Globalization.NoAsyncCurrentCulture";
internal static readonly string SwitchEnforceJapaneseEraYearRanges = "Switch.System.Globalization.EnforceJapaneseEraYearRanges";
internal static readonly string SwitchFormatJapaneseFirstYearAsANumber = "Switch.System.Globalization.FormatJapaneseFirstYearAsANumber";
internal static readonly string SwitchEnforceLegacyJapaneseDateParsing = "Switch.System.Globalization.EnforceLegacyJapaneseDateParsing";
internal const string SwitchThrowExceptionIfDisposedCancellationTokenSource = "Switch.System.Threading.ThrowExceptionIfDisposedCancellationTokenSource";
internal const string SwitchPreserveEventListnerObjectIdentity = "Switch.System.Diagnostics.EventSource.PreserveEventListnerObjectIdentity";
internal const string SwitchUseLegacyPathHandling = "Switch.System.IO.UseLegacyPathHandling";

View File

@@ -7,10 +7,17 @@ using nuint = System.UInt32;
using System.Runtime.CompilerServices;
using System.Runtime;
#if NETCORE
using Internal.Runtime.CompilerServices;
#endif
namespace System
{
partial class Buffer
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern unsafe void InternalMemcpy (byte *dest, byte *src, int count);
public static int ByteLength (Array array)
{
// note: the other methods in this class also use ByteLength to test for
@@ -21,7 +28,7 @@ namespace System
int length = _ByteLength (array);
if (length < 0)
throw new ArgumentException (Locale.GetText ("Object must be an array of primitives."));
throw new ArgumentException ("Object must be an array of primitives.");
return length;
}
@@ -51,25 +58,22 @@ namespace System
throw new ArgumentNullException ("dst");
if (srcOffset < 0)
throw new ArgumentOutOfRangeException ("srcOffset", Locale.GetText(
"Non-negative number required."));
throw new ArgumentOutOfRangeException ("srcOffset", "Non-negative number required.");
if (dstOffset < 0)
throw new ArgumentOutOfRangeException ("dstOffset", Locale.GetText (
"Non-negative number required."));
throw new ArgumentOutOfRangeException ("dstOffset", "Non-negative number required.");
if (count < 0)
throw new ArgumentOutOfRangeException ("count", Locale.GetText (
"Non-negative number required."));
throw new ArgumentOutOfRangeException ("count", "Non-negative number required.");
// We do the checks in unmanaged code for performance reasons
bool res = InternalBlockCopy (src, srcOffset, dst, dstOffset, count);
if (!res) {
// watch for integer overflow
if ((srcOffset > ByteLength (src) - count) || (dstOffset > ByteLength (dst) - count))
throw new ArgumentException (Locale.GetText (
throw new ArgumentException (
"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."));
"the number of elements from index to the end of the source collection.");
}
}
@@ -191,6 +195,11 @@ namespace System
}
internal static unsafe void Memcpy (byte *dest, byte *src, int len) {
// For bigger lengths, we use the heavily optimized native code
if (len > 32) {
InternalMemcpy (dest, src, len);
return;
}
// FIXME: if pointers are not aligned, try to align them
// so a faster routine can be used. Handle the case where
// the pointers can't be reduced to have the same alignment
@@ -246,4 +255,4 @@ namespace System
}
}
}
}
}

View File

@@ -77,15 +77,7 @@ namespace System.Globalization
{
if (UseManagedCollation)
return GetCollator ().GetSortKey (source, options);
SortKey key=new SortKey (culture, source, options);
/* Need to do the icall here instead of in the
* SortKey constructor, as we need access to
* this instance's collator.
*/
assign_sortkey (key, source, options);
return(key);
return new SortKey (culture, source, options);
}
int internal_index_switch (string s1, int sindex, int count, string s2, CompareOptions opt, bool first)
@@ -96,7 +88,7 @@ namespace System.Globalization
return UseManagedCollation ?
internal_index_managed (s1, sindex, count, s2, opt, first) :
internal_index (s1, sindex, count, s2, opt, first);
internal_index (s1, sindex, count, s2, first);
}
int internal_compare_switch (string str1, int offset1, int length1, string str2, int offset2, int length2, CompareOptions options)
@@ -129,25 +121,29 @@ namespace System.Globalization
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern void assign_sortkey (object key, string source,
CompareOptions options);
private static unsafe extern int internal_compare_icall (char* str1, int length1,
char* str2, int length2, CompareOptions options);
private static unsafe int internal_compare (string str1, int offset1,
int length1, string str2, int offset2, int length2, CompareOptions options)
{
fixed (char* fixed_str1 = str1,
fixed_str2 = str2)
return internal_compare_icall (fixed_str1 + offset1, length1,
fixed_str2 + offset2, length2, options);
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern int internal_compare (string str1, int offset1,
int length1, string str2,
int offset2, int length2,
CompareOptions options);
private static unsafe extern int internal_index_icall (char *source, int sindex,
int count, char *value, int value_length, bool first);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern int internal_index (string source, int sindex,
int count, char value,
CompareOptions options,
bool first);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern int internal_index (string source, int sindex,
int count, string value,
CompareOptions options,
bool first);
private static unsafe int internal_index (string source, int sindex,
int count, string value, bool first)
{
fixed (char* fixed_source = source,
fixed_value = value)
return internal_index_icall (fixed_source, sindex, count,
fixed_value, value?.Length ?? 0, first);
}
}
}
}

View File

@@ -239,6 +239,9 @@ namespace System.Globalization
case "zh":
waCalendars = new int[] { calendarId, Calendar.CAL_TAIWAN };
break;
case "he":
waCalendars = new int[] { calendarId, Calendar.CAL_HEBREW };
break;
default:
waCalendars = new int [] { calendarId };
break;
@@ -249,6 +252,14 @@ namespace System.Globalization
}
}
internal CalendarId[] GetCalendarIds()
{
var items = new CalendarId[CalendarIds.Length];
for (int i = 0; i < CalendarIds.Length; i++)
items[i] = (CalendarId)CalendarIds[i];
return items;
}
internal bool IsInvariantCulture {
get {
return string.IsNullOrEmpty (sRealName);
@@ -433,6 +444,19 @@ namespace System.Globalization
// Date separator (derived from short date format)
internal String DateSeparator(int calendarId)
{
#if MONO // see https://github.com/dotnet/coreclr/pull/19976
if (calendarId == (int)CalendarId.JAPAN && !AppContextSwitches.EnforceLegacyJapaneseDateParsing)
{
// The date separator is derived from the default short date pattern. So far this pattern is using
// '/' as date separator when using the Japanese calendar which make the formatting and parsing work fine.
// changing the default pattern is likely will happen in the near future which can easily break formatting
// and parsing.
// We are forcing here the date separator to '/' to ensure the parsing is not going to break when changing
// the default short date pattern. The application still can override this in the code by DateTimeFormatInfo.DateSeparartor.
return "/";
}
#endif
return GetDateSeparator(ShortDates(calendarId)[0]);
}

View File

@@ -1,7 +1,6 @@
namespace System.Runtime.CompilerServices {
[FriendAccessAllowed]
internal static class JitHelpers
{
static internal T UnsafeCast<T>(Object o) where T : class

View File

@@ -2,7 +2,9 @@
using System.Reflection.Emit;
#endif
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Text;
namespace System.Reflection
{
@@ -44,30 +46,112 @@ namespace System.Reflection
throw new Exception ("Method is not a builder method");
}
internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle)
internal virtual string FormatNameAndSig (bool serialization)
{
return GetMethodFromHandleInternalType_native (handle.Value, IntPtr.Zero, false);
// Serialization uses ToString to resolve MethodInfo overloads.
StringBuilder sbName = new StringBuilder (Name);
sbName.Append ("(");
sbName.Append (ConstructParameters (GetParameterTypes (), CallingConvention, serialization));
sbName.Append (")");
return sbName.ToString ();
}
internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle, RuntimeTypeHandle reflectedType)
internal virtual Type[] GetParameterTypes ()
{
return GetMethodFromHandleInternalType_native (handle.Value, reflectedType.Value, false);
ParameterInfo[] paramInfo = GetParametersNoCopy ();
Type[] parameterTypes = new Type [paramInfo.Length];
for (int i = 0; i < paramInfo.Length; i++)
parameterTypes [i] = paramInfo [i].ParameterType;
return parameterTypes;
}
internal virtual ParameterInfo[] GetParametersNoCopy () => GetParameters ();
public static MethodBase GetMethodFromHandle (RuntimeMethodHandle handle)
{
if (handle.IsNullHandle ())
throw new ArgumentException (Environment.GetResourceString("Argument_InvalidHandle"));
#if MONO
MethodBase m = RuntimeMethodInfo.GetMethodFromHandleInternalType (handle.Value, IntPtr.Zero);
if (m == null)
throw new ArgumentException ("The handle is invalid.");
#else
MethodBase m = RuntimeType.GetMethodBase (handle.GetMethodInfo ());
#endif
Type declaringType = m.DeclaringType;
if (declaringType != null && declaringType.IsGenericType)
throw new ArgumentException (String.Format (
CultureInfo.CurrentCulture, Environment.GetResourceString ("Argument_MethodDeclaringTypeGeneric"),
m, declaringType.GetGenericTypeDefinition ()));
return m;
}
[System.Runtime.InteropServices.ComVisible(false)]
public static MethodBase GetMethodFromHandle (RuntimeMethodHandle handle, RuntimeTypeHandle declaringType)
{
if (handle.IsNullHandle ())
throw new ArgumentException (Environment.GetResourceString("Argument_InvalidHandle"));
#if MONO
MethodBase m = RuntimeMethodInfo.GetMethodFromHandleInternalType (handle.Value, declaringType.Value);
if (m == null)
throw new ArgumentException ("The handle is invalid.");
return m;
#else
return RuntimeType.GetMethodBase (declaringType.GetRuntimeType (), handle.GetMethodInfo ());
#endif
}
internal static string ConstructParameters (Type[] parameterTypes, CallingConventions callingConvention, bool serialization)
{
StringBuilder sbParamList = new StringBuilder ();
string comma = "";
for (int i = 0; i < parameterTypes.Length; i++) {
Type t = parameterTypes [i];
sbParamList.Append (comma);
string typeName = t.FormatTypeName (serialization);
// Legacy: Why use "ByRef" for by ref parameters? What language is this?
// VB uses "ByRef" but it should precede (not follow) the parameter name.
// Why don't we just use "&"?
if (t.IsByRef && !serialization) {
sbParamList.Append (typeName.TrimEnd (new char[] { '&' }));
sbParamList.Append (" ByRef");
} else {
sbParamList.Append (typeName);
}
comma = ", ";
}
if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs) {
sbParamList.Append (comma);
sbParamList.Append ("...");
}
return sbParamList.ToString ();
}
#if MONO
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal extern static MethodBody GetMethodBodyInternal (IntPtr handle);
internal static MethodBody GetMethodBody (IntPtr handle)
public extern static MethodBase GetCurrentMethod ();
#else
[System.Security.DynamicSecurityMethod] // Specify DynamicSecurityMethod attribute to prevent inlining of the caller.
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public static MethodBase GetCurrentMethod ()
{
return GetMethodBodyInternal (handle);
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RuntimeMethodInfo.InternalGetCurrentMethod (ref stackMark);
}
static MethodBase GetMethodFromHandleInternalType (IntPtr method_handle, IntPtr type_handle) {
return GetMethodFromHandleInternalType_native (method_handle, type_handle, true);
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal extern static MethodBase GetMethodFromHandleInternalType_native (IntPtr method_handle, IntPtr type_handle, bool genericCheck);
#endif
}
}

View File

@@ -1,6 +1,6 @@
namespace System.IO
{
static class PathInternal
internal static partial class PathInternal
{
public static bool IsPartiallyQualified (string path)
{

View File

@@ -48,14 +48,16 @@ namespace System
// ,+*&*[]\ in the identifier portions of the names
// have been escaped with a leading backslash (\)
public string full_name;
public MonoCMethod default_ctor;
public RuntimeConstructorInfo default_ctor;
}
[StructLayout (LayoutKind.Sequential)]
partial class RuntimeType
{
#region keep in sync with object-internals.h
[NonSerialized]
MonoTypeInfo type_info;
#endregion
internal Object GenericCache;
@@ -64,9 +66,9 @@ namespace System
throw new NotImplementedException ();
}
internal MonoCMethod GetDefaultConstructor ()
internal RuntimeConstructorInfo GetDefaultConstructor ()
{
MonoCMethod ctor = null;
RuntimeConstructorInfo ctor = null;
if (type_info == null)
type_info = new MonoTypeInfo ();
@@ -78,7 +80,7 @@ namespace System
for (int i = 0; i < ctors.Length; ++i) {
if (ctors [i].GetParametersCount () == 0) {
type_info.default_ctor = ctor = (MonoCMethod) ctors [i];
type_info.default_ctor = ctor = (RuntimeConstructorInfo) ctors [i];
break;
}
}
@@ -93,6 +95,7 @@ namespace System
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern ConstructorInfo GetCorrespondingInflatedConstructor (ConstructorInfo generic);
#if !NETCORE
internal override MethodInfo GetMethod (MethodInfo fromNoninstanciated)
{
if (fromNoninstanciated == null)
@@ -114,6 +117,7 @@ namespace System
flags |= fromNoninstanciated.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic;
return GetField (fromNoninstanciated.Name, flags);
}
#endif
string GetDefaultMemberName ()
{
@@ -168,12 +172,12 @@ namespace System
if (IsValueType)
return CreateInstanceInternal (this);
throw new MissingMethodException (Locale.GetText ("Default constructor not found for type " + FullName));
throw new MissingMethodException ("Default constructor not found for type " + FullName);
}
// TODO: .net does more checks in unmanaged land in RuntimeTypeHandle::CreateInstance
if (IsAbstract) {
throw new MissingMethodException (Locale.GetText ("Cannot create an abstract class '{0}'.", FullName));
throw new MissingMethodException ("Cannot create an abstract class '{0}'.", FullName);
}
return ctor.InternalInvoke (null, null, wrapExceptions);
@@ -419,12 +423,18 @@ namespace System
public override Type MakePointerType ()
{
if (IsByRef)
throw new TypeLoadException ($"Could not load type '{GetType()}' from assembly '{AssemblyQualifiedName}");
return MakePointerType (this);
}
public override StructLayoutAttribute StructLayoutAttribute {
get {
#if NETCORE
throw new NotImplementedException ();
#else
return StructLayoutAttribute.GetCustomAttribute (this);
#endif
}
}
@@ -483,7 +493,7 @@ namespace System
var a = new RuntimeMethodInfo [n];
for (int i = 0; i < n; i++) {
var mh = new RuntimeMethodHandle (h[i]);
a[i] = (RuntimeMethodInfo) MethodBase.GetMethodFromHandleNoGenericCheck (mh, refh);
a[i] = (RuntimeMethodInfo) RuntimeMethodInfo.GetMethodFromHandleNoGenericCheck (mh, refh);
}
return a;
}
@@ -503,7 +513,7 @@ namespace System
var a = new RuntimeConstructorInfo [n];
for (int i = 0; i < n; i++) {
var mh = new RuntimeMethodHandle (h[i]);
a[i] = (RuntimeConstructorInfo) MethodBase.GetMethodFromHandleNoGenericCheck (mh, refh);
a[i] = (RuntimeConstructorInfo) RuntimeMethodInfo.GetMethodFromHandleNoGenericCheck (mh, refh);
}
return a;
}
@@ -518,7 +528,7 @@ namespace System
var a = new RuntimePropertyInfo [n];
for (int i = 0; i < n; i++) {
var ph = new Mono.RuntimePropertyHandle (h[i]);
a[i] = (RuntimePropertyInfo) MonoProperty.GetPropertyFromHandle (ph, refh);
a[i] = (RuntimePropertyInfo) RuntimePropertyInfo.GetPropertyFromHandle (ph, refh);
}
return a;
}
@@ -540,14 +550,14 @@ namespace System
InterfaceMapping res;
if (!ifaceType.IsInterface)
throw new ArgumentException (Locale.GetText ("Argument must be an interface."), "ifaceType");
throw new ArgumentException ("Argument must be an interface.", "ifaceType");
if (IsInterface)
throw new ArgumentException ("'this' type cannot be an interface itself");
res.TargetType = this;
res.InterfaceType = ifaceType;
GetInterfaceMapData (this, ifaceType, out res.TargetMethods, out res.InterfaceMethods);
if (res.TargetMethods == null)
throw new ArgumentException (Locale.GetText ("Interface not found"), "ifaceType");
throw new ArgumentException ("Interface not found", "ifaceType");
return res;
}
@@ -673,7 +683,7 @@ namespace System
extern int GetGenericParameterPosition ();
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern IntPtr GetEvents_native (IntPtr name, BindingFlags bindingAttr, MemberListType listType);
extern IntPtr GetEvents_native (IntPtr name, MemberListType listType);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern IntPtr GetFields_native (IntPtr name, BindingFlags bindingAttr, MemberListType listType);
@@ -687,7 +697,11 @@ namespace System
var a = new RuntimeFieldInfo[n];
for (int i = 0; i < n; i++) {
var fh = new RuntimeFieldHandle (h[i]);
#if NETCORE
throw new NotImplementedException ();
#else
a[i] = (RuntimeFieldInfo) FieldInfo.GetFieldFromHandle (fh, refh);
#endif
}
return a;
}
@@ -697,12 +711,16 @@ namespace System
{
var refh = new RuntimeTypeHandle (reflectedType);
using (var namePtr = new Mono.SafeStringMarshal (name))
using (var h = new Mono.SafeGPtrArrayHandle (GetEvents_native (namePtr.Value, bindingAttr, listType))) {
using (var h = new Mono.SafeGPtrArrayHandle (GetEvents_native (namePtr.Value, listType))) {
int n = h.Length;
var a = new RuntimeEventInfo[n];
for (int i = 0; i < n; i++) {
var eh = new Mono.RuntimeEventHandle (h[i]);
#if NETCORE
throw new NotImplementedException ();
#else
a[i] = (RuntimeEventInfo) EventInfo.GetEventFromHandle (eh, refh);
#endif
}
return a;
}
@@ -717,8 +735,12 @@ namespace System
RuntimeType[] GetNestedTypes_internal (string displayName, BindingFlags bindingAttr, MemberListType listType)
{
string internalName = null;
#if NETCORE
throw new NotImplementedException ();
#else
if (displayName != null)
internalName = TypeIdentifiers.FromDisplay (displayName).InternalName;
#endif
using (var namePtr = new Mono.SafeStringMarshal (internalName))
using (var h = new Mono.SafeGPtrArrayHandle (GetNestedTypes_native (namePtr.Value, bindingAttr, listType))) {
int n = h.Length;
@@ -800,7 +822,9 @@ namespace System
}
}
#if !NETCORE
public sealed override bool HasSameMetadataDefinitionAs (MemberInfo other) => HasSameMetadataDefinitionAsCore<RuntimeType> (other);
#endif
public override bool IsSZArray {
get {
@@ -809,11 +833,13 @@ namespace System
}
}
#if !NETCORE
internal override bool IsUserType {
get {
return false;
}
}
#endif
[System.Runtime.InteropServices.ComVisible(true)]
[Pure]
@@ -828,5 +854,13 @@ namespace System
return RuntimeTypeHandle.IsSubclassOf (this, rtType);
}
public override bool IsByRefLike {
get {
return RuntimeTypeHandle.IsByRefLike (this);
}
}
public override bool IsTypeDefinition => RuntimeTypeHandle.IsTypeDefinition (this);
}
}

View File

@@ -242,25 +242,6 @@ namespace System
return countA - countB;
}
internal static unsafe void CharCopy (char *dest, char *src, int count) {
// Same rules as for memcpy, but with the premise that
// chars can only be aligned to even addresses if their
// enclosing types are correctly aligned
if ((((int)(byte*)dest | (int)(byte*)src) & 3) != 0) {
if (((int)(byte*)dest & 2) != 0 && ((int)(byte*)src & 2) != 0 && count > 0) {
((short*)dest) [0] = ((short*)src) [0];
dest++;
src++;
count--;
}
if ((((int)(byte*)dest | (int)(byte*)src) & 2) != 0) {
Buffer.memcpy2 ((byte*)dest, (byte*)src, count * 2);
return;
}
}
Buffer.memcpy4 ((byte*)dest, (byte*)src, count * 2);
}
#region Runtime method-to-ir dependencies
/* helpers used by the runtime as well as above or eslewhere in corlib */
@@ -453,4 +434,4 @@ namespace System
return hash1 + (hash2 * 1566083941);
}
}
}
}

View File

@@ -29,71 +29,15 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using StackCrawlMark = System.Threading.StackCrawlMark;
namespace System
{
[Serializable]
partial class Type : MemberInfo
{
internal RuntimeTypeHandle _impl;
#region Requires stack backtracing fixes in unmanaged type_from_name
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern Type internal_from_name (string name, bool throwOnError, bool ignoreCase);
public static Type GetType(string typeName)
{
return GetType (typeName, false, false);
}
public static Type GetType(string typeName, bool throwOnError)
{
return GetType (typeName, throwOnError, false);
}
public static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
{
if (typeName == null)
throw new ArgumentNullException ("TypeName");
if (typeName == String.Empty)
if (throwOnError)
throw new TypeLoadException ("A null or zero length string does not represent a valid Type.");
else
return null;
Type t = internal_from_name (typeName, throwOnError, ignoreCase);
if (throwOnError && t == null)
throw new TypeLoadException ("Error loading '" + typeName + "'");
return t;
}
#endregion
// TODO: Merge with internal_from_name
public static Type ReflectionOnlyGetType (string typeName,
bool throwIfNotFound,
bool ignoreCase)
{
if (typeName == null)
throw new ArgumentNullException ("typeName");
if (typeName == String.Empty && throwIfNotFound)
throw new TypeLoadException ("A null or zero length string does not represent a valid Type");
int idx = typeName.IndexOf (',');
if (idx < 0 || idx == 0 || idx == typeName.Length - 1)
throw new ArgumentException ("Assembly qualifed type name is required", "typeName");
string an = typeName.Substring (idx + 1);
Assembly a;
try {
a = Assembly.ReflectionOnlyLoad (an);
} catch {
if (throwIfNotFound)
throw;
return null;
}
return a.GetType (typeName.Substring (0, idx), throwIfNotFound, ignoreCase);
}
internal virtual Type InternalResolve ()
{
return UnderlyingSystemType;
@@ -138,5 +82,107 @@ namespace System
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern Type internal_from_handle (IntPtr handle);
internal virtual RuntimeTypeHandle GetTypeHandleInternal () => TypeHandle;
#if FEATURE_COMINTEROP || MONO_COM
virtual internal bool IsWindowsRuntimeObjectImpl () => throw new NotImplementedException ();
virtual internal bool IsExportedToWindowsRuntimeImpl () => throw new NotImplementedException ();
internal bool IsWindowsRuntimeObject => IsWindowsRuntimeObjectImpl ();
internal bool IsExportedToWindowsRuntime => IsExportedToWindowsRuntimeImpl ();
#endif // FEATURE_COMINTEROP
internal virtual bool HasProxyAttributeImpl () => false;
internal virtual bool IsSzArray => false;
// This is only ever called on RuntimeType objects.
internal string FormatTypeName () => FormatTypeName (false);
internal virtual string FormatTypeName (bool serialization) => throw new NotImplementedException();
public bool IsInterface {
get {
RuntimeType rt = this as RuntimeType;
if (rt != null)
return RuntimeTypeHandle.IsInterface (rt);
return ((GetAttributeFlagsImpl() & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface);
}
}
[MethodImplAttribute (MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public static Type GetType (String typeName, bool throwOnError, bool ignoreCase)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RuntimeType.GetType (typeName, throwOnError, ignoreCase, false, ref stackMark);
}
[MethodImplAttribute (MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public static Type GetType (String typeName, bool throwOnError)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RuntimeType.GetType (typeName, throwOnError, false, false, ref stackMark);
}
[MethodImplAttribute (MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public static Type GetType (String typeName) {
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RuntimeType.GetType (typeName, false, false, false, ref stackMark);
}
// Methods containing StackCrawlMark local var has to be marked non-inlineable
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static Type GetType (
string typeName,
Func<AssemblyName, Assembly> assemblyResolver,
Func<Assembly, string, bool, Type> typeResolver)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return TypeNameParser.GetType (typeName, assemblyResolver, typeResolver, false, false, ref stackMark);
}
// Methods containing StackCrawlMark local var has to be marked non-inlineable
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static Type GetType (
string typeName,
Func<AssemblyName, Assembly> assemblyResolver,
Func<Assembly, string, bool, Type> typeResolver,
bool throwOnError)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return TypeNameParser.GetType (typeName, assemblyResolver, typeResolver, throwOnError, false, ref stackMark);
}
// Methods containing StackCrawlMark local var has to be marked non-inlineable
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static Type GetType(
string typeName,
Func<AssemblyName, Assembly> assemblyResolver,
Func<Assembly, string, bool, Type> typeResolver,
bool throwOnError,
bool ignoreCase)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return TypeNameParser.GetType (typeName, assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark);
}
public static bool operator == (Type left, Type right)
{
return object.ReferenceEquals (left, right);
}
public static bool operator != (Type left, Type right)
{
return !object.ReferenceEquals (left, right);
}
#if !NETCORE
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public static Type ReflectionOnlyGetType (String typeName, bool throwIfNotFound, bool ignoreCase)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RuntimeType.GetType (typeName, throwIfNotFound, ignoreCase, true /*reflectionOnly*/, ref stackMark);
}
#endif
}
}

View File

@@ -14,7 +14,7 @@ namespace System
ref StackCrawlMark stackMark)
{
TypeSpec spec = TypeSpec.Parse (typeName);
return spec.Resolve (assemblyResolver, typeResolver, throwOnError, ignoreCase);
return spec.Resolve (assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark);
}
}
}