Imported Upstream version 5.18.0.142

Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-09 08:20:59 +00:00
parent e52655b4dc
commit 0abdbe5a7d
1547 changed files with 93792 additions and 47893 deletions

View File

@@ -64,6 +64,18 @@ namespace System.Reflection {
this.lazyData.data_length = data_length;
}
internal CustomAttributeData (ConstructorInfo ctorInfo)
: this (ctorInfo, Array.Empty<CustomAttributeTypedArgument> (), Array.Empty<CustomAttributeNamedArgument> ())
{
}
internal CustomAttributeData (ConstructorInfo ctorInfo, IList<CustomAttributeTypedArgument> ctorArgs, IList<CustomAttributeNamedArgument> namedArgs)
{
this.ctorInfo = ctorInfo;
this.ctorArgs = ctorArgs;
this.namedArgs = namedArgs;
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
static extern void ResolveArgumentsInternal (ConstructorInfo ctor, Assembly assembly, IntPtr data, uint data_length, out object[] ctorArgs, out object[] namedArgs);

View File

@@ -1,63 +0,0 @@
//
// System.Reflection.CustomAttributeFormatException.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System.Reflection
{
[ComVisible (true)]
[Serializable]
public class CustomAttributeFormatException : FormatException
{
// Constructors
public CustomAttributeFormatException ()
: base (Locale.GetText ("The Binary format of the custom attribute is invalid."))
{
}
public CustomAttributeFormatException (string message)
: base (message)
{
}
public CustomAttributeFormatException (string message, Exception inner)
: base (message, inner)
{
}
protected CustomAttributeFormatException (SerializationInfo info,
StreamingContext context)
{
}
}
}

View File

@@ -27,6 +27,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.CompilerServices;
@@ -222,6 +223,46 @@ namespace System.Reflection {
return attrs;
}
internal CustomAttributeData[] GetPseudoCustomAttributesData ()
{
int count = 0;
if (IsNotSerialized)
count++;
if (DeclaringType.IsExplicitLayout)
count++;
MarshalAsAttribute marshalAs = get_marshal_info ();
if (marshalAs != null)
count++;
if (count == 0)
return null;
CustomAttributeData[] attrsData = new CustomAttributeData [count];
count = 0;
if (IsNotSerialized)
attrsData [count++] = new CustomAttributeData ((typeof (NonSerializedAttribute)).GetConstructor (Type.EmptyTypes));
if (DeclaringType.IsExplicitLayout) {
var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (int), GetFieldOffset ()) };
attrsData [count++] = new CustomAttributeData (
(typeof (FieldOffsetAttribute)).GetConstructor (new[] { typeof (int) }),
ctorArgs,
EmptyArray<CustomAttributeNamedArgument>.Value);
}
if (marshalAs != null) {
var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (UnmanagedType), marshalAs.Value) };
attrsData [count++] = new CustomAttributeData (
(typeof (MarshalAsAttribute)).GetConstructor (new[] { typeof (UnmanagedType) }),
ctorArgs,
EmptyArray<CustomAttributeNamedArgument>.Value);//FIXME Get named params
}
return attrsData;
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern Type[] GetTypeModifiers (bool optional);

View File

@@ -1,43 +0,0 @@
//
// System.Reflection.ImageFileMachine enumeration
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Reflection {
[ComVisible (true)]
[Serializable]
public enum ImageFileMachine {
I386 = 332,
IA64 = 512,
AMD64 = 34404,
ARM = 452,
}
}

View File

@@ -427,6 +427,37 @@ namespace System.Reflection {
return attrs;
}
internal CustomAttributeData[] GetPseudoCustomAttributesData ()
{
int count = 0;
/* MS.NET doesn't report MethodImplAttribute */
MonoMethodInfo info = MonoMethodInfo.GetMethodInfo (mhandle);
if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
count++;
if ((info.attrs & MethodAttributes.PinvokeImpl) != 0)
count++;
if (count == 0)
return null;
CustomAttributeData[] attrsData = new CustomAttributeData [count];
count = 0;
if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
attrsData [count++] = new CustomAttributeData ((typeof (PreserveSigAttribute)).GetConstructor (Type.EmptyTypes));
if ((info.attrs & MethodAttributes.PinvokeImpl) != 0) {
this.GetPInvoke (out PInvokeAttributes flags, out string entryPoint, out string dllName);
var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument(typeof(string), dllName) };
attrsData [count++] = new CustomAttributeData (
(typeof (FieldOffsetAttribute)).GetConstructor (new[] { typeof (string) }),
ctorArgs,
EmptyArray<CustomAttributeNamedArgument>.Value); //FIXME Get named params
}
return attrsData;
}
public override MethodInfo MakeGenericMethod (Type [] methodInstantiation)
{
if (methodInstantiation == null)

View File

@@ -1,4 +1,4 @@
// System.Reflection.ParameterInfo
// System.Reflection.ParameterInfo
//
// Authors:
// Sean MacIsaac (macisaac@ximian.com)
@@ -175,6 +175,41 @@ namespace System.Reflection
return attrs;
}
internal CustomAttributeData[] GetPseudoCustomAttributesData ()
{
int count = 0;
if (IsIn)
count++;
if (IsOut)
count++;
if (IsOptional)
count++;
if (marshalAs != null)
count++;
if (count == 0)
return null;
CustomAttributeData[] attrsData = new CustomAttributeData [count];
count = 0;
if (IsIn)
attrsData [count++] = new CustomAttributeData ((typeof (InAttribute)).GetConstructor (Type.EmptyTypes));
if (IsOptional)
attrsData [count++] = new CustomAttributeData ((typeof (OptionalAttribute)).GetConstructor (Type.EmptyTypes));
if (IsOut)
attrsData [count++] = new CustomAttributeData ((typeof (OutAttribute)).GetConstructor (Type.EmptyTypes));
if (marshalAs != null) {
var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (UnmanagedType), marshalAs.Value) };
attrsData [count++] = new CustomAttributeData (
(typeof (MarshalAsAttribute)).GetConstructor (new[] { typeof( UnmanagedType) }),
ctorArgs,
EmptyArray<CustomAttributeNamedArgument>.Value);//FIXME Get named params
}
return attrsData;
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal extern Type[] GetTypeModifiers (bool optional);

View File

@@ -1,47 +0,0 @@
//
// System.Reflection.PortableExecutableKinds flag
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Reflection {
[ComVisible (true)]
[Flags]
[Serializable]
public enum PortableExecutableKinds {
NotAPortableExecutableImage = 0,
ILOnly = 1,
Required32Bit = 2,
PE32Plus = 4,
Unmanaged32Bit = 8,
Preferred32Bit = 16
}
}